🔧 OpenAPI to CLI — OpenAPI工具

v1.0.0

[AI辅助] Generate CLI tools from OpenAPI specs. Built for AI agents who hate writing curl commands.

3· 1.6k·1 当前·1 累计
by @awlevin (Aaron Levin)·MIT-0
下载技能包
License
MIT-0
最后更新
2026/2/28
0
安全扫描
VirusTotal
无害
查看报告
OpenClaw
可疑
high confidence
The skill's runtime instructions match its stated purpose, but the install spec points to a mismatched/ambiguous pip package ('uv' → provides 'uvx') instead of the referenced 'openapi2cli' project, creating a supply-chain / incoherence risk.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.0.02026/2/6

Initial release - generate CLIs from OpenAPI specs

无害

安装命令

点击复制
官方npx clawhub@latest install openapi2cli
🇨🇳 镜像加速npx clawhub@latest install openapi2cli --registry https://cn.longxiaskill.com

技能文档

Generate command-line tools from OpenAPI/Swagger specs. Perfect for AI agents that need to interact with APIs without writing curl commands.

Quick 开始

# generate a CLI from any OpenAPI spec
uvx openapi2cli generate https://api.example.com/openapi.json --output my-api

# use the generated CLI python my-api.py users list python my-api.py users get --id 123 python my-api.py posts create --title "Hello" --body "World"

Features

  • Auto-generates CLI 从 OpenAPI 3.x specs
  • Supports auth: API keys, Bearer tokens, Basic auth
  • Rich help: --help 在...上 任何 command shows params
  • JSON 输出: Structured responses 对于 parsing
  • Dry-run mode: See 请求 没有 sending

Usage

# from URL
uvx openapi2cli generate https://api.example.com/openapi.json -o my-cli

# from local file uvx openapi2cli generate ./spec.yaml -o my-cli

# with base URL override uvx openapi2cli generate ./spec.json -o my-cli --base-url https://api.prod.com

Generated CLI

# set auth via env
export MY_CLI_API_KEY="sk-..."

# or via flag python my-cli.py --api-key "sk-..." users list

# see available commands python my-cli.py --help

# see command options python my-cli.py users create --help

示例: GitHub API

uvx openapi2cli generate https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.json -o github-cli

python github-cli.py repos list --owner octocat

为什么?

AI agents work better with CLIs than raw HTTP:

  • Discoverable commands 通过 --help
  • 标签页 completion friendly
  • 否 需要 到 construct JSON payloads
  • Easy 到 chain 带有 pipes

Links

数据来源:ClawHub ↗ · 中文优化:龙虾技能库