← 返回
开发者工具 中文

OpenAPI to CLI

Generate CLI tools from OpenAPI specs. Built for AI agents who hate writing curl commands.
根据 OpenAPI 规范生成 CLI 工具,专为不想编写 curl 命令的 AI 代理打造。
awlevin
开发者工具 clawhub v1.0.0 1 版本 99801.1 Key: 无需
★ 3
Stars
📥 1,947
下载
💾 24
安装
1
版本
#latest

概述

OpenAPI to CLI

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

Quick Start

# 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 from OpenAPI 3.x specs
  • Supports auth: API keys, Bearer tokens, Basic auth
  • Rich help: --help on any command shows params
  • JSON output: Structured responses for parsing
  • Dry-run mode: See the request without 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

Example: 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

Why?

AI agents work better with CLIs than raw HTTP:

  • Discoverable commands via --help
  • Tab completion friendly
  • No need to construct JSON payloads
  • Easy to chain with pipes

Links

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-28 18:18 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 668 📥 324,187
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,803
communication-collaboration

Agent Chat

awlevin
AI 代理的临时实时聊天室,支持密码保护、SSE 流式传输、人类用 Web UI 以及代理用 CLI 工具。
★ 0 📥 2,264