Documentation v1.0.0

openapi2cli-awlevin

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

awlevin 更新于 2026-02-06 1 浏览
下载 SKILL

技能说明

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

使用场景

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

直接复制以下提示词,发送给你的 AI 助手即可完成安装。

帮我下载并安装这个SKILL:https://skillhub.cstcloud.cn/download/openapi2cli-awlevin
  1. 点击上方「下载 SKILL」按钮,获取技能压缩包。
  2. 将压缩包解压到你的 Agent 技能目录。
  3. 重启客户端后即可在技能列表中选择该技能。

技能文件内容

4 个文件 · 24 kB
SKILL.md text/markdown
---
name: openapi2cli
description: Generate CLI tools from OpenAPI specs. Built for AI agents who hate writing curl commands.
homepage: https://github.com/Olafs-World/openapi2cli
metadata:
  {
    "openclaw":
      {
        "emoji": "🔧",
        "requires": { "bins": ["uvx"] },
        "install":
          [
            {
              "id": "uv",
              "kind": "pip",
              "package": "uv",
              "bins": ["uvx"],
              "label": "Install uv (for uvx)",
            },
          ],
      },
  }
---

# 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

```bash
# 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

```bash
# 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

```bash
# 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

```bash
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

- [PyPI](https://pypi.org/project/openapi2cli/)
- [GitHub](https://github.com/Olafs-World/openapi2cli)

文件内容直接读取自技能仓库,仅供安装前审阅;以实际下载的压缩包为准。