Skip to main content

clapikit

CLI tool for OpenAPI specifications.

Description

clapikit (CLI + API + Kit) is a command-line tool that parses OpenAPI YAML/JSON files and provides a CLI interface to interact with APIs defined in those specifications. It dynamically generates subcommands based on the endpoints defined in the OpenAPI specification.

Installation

# Install with uvx
uvx clapikit

# Or install with pip
pip install clapikit

Usage

# List available commands from an OpenAPI specification
clapikit --spec https://example.com/openapi.yaml

# Execute an API endpoint
clapikit --spec https://example.com/openapi.yaml getUserInfo

# Override server URL
clapikit --spec https://example.com/openapi.yaml --server http://custom-server:8080 getUserInfo

# Enable debug output
clapikit --spec https://example.com/openapi.yaml --debug getUserInfo

# Send data with a request
clapikit --spec https://example.com/openapi.yaml createUser --data '{"name": "John", "email": "john@example.com"}'

# Specify query parameters
clapikit --spec https://example.com/openapi.yaml searchUsers --params '{"role": "admin", "limit": 10}'

# Set custom headers
clapikit --spec https://example.com/openapi.yaml getUserInfo --headers '{"Authorization": "Bearer token123"}'

# Control output format
clapikit --spec https://example.com/openapi.yaml getUserInfo --output text

Features

  • Parse OpenAPI YAML/JSON files from local paths or URLs
  • Dynamically generate subcommands based on API endpoints
  • Execute API requests directly from the command line
  • Override server URL from command line
  • Debug mode for detailed logging
  • Support for request data, query parameters, and headers
  • JSON and text output formats

Development

# Clone the repository
git clone https://github.com/youyo/clapikit.git
cd clapikit

# Install development dependencies
uv pip install -e .

# Run tests
python test_cli.py

Mock Server for Testing

You can use Prism to run a mock server for testing:

npx @stoplight/prism-cli mock https://learn.openapis.org/examples/v3.0/api-with-examples.yaml

License

See the LICENSE file for details.

Metadata

Release files for clapikit 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for clapikit 0.1.0
File Size Uploaded
clapikit-0.1.0.tar.gz 44.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for clapikit 0.1.0
File Interpreter ABI Platform
clapikit-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 51.4 kB

Release files / clapikit-0.1.0.tar.gz

Download URL clapikit-0.1.0.tar.gz
Size 44.9 kB
Tags Source
SHA-256 checksum
How to use checksums
96cead7435b17d1dac1e01f9ea2d37643f3f2773e6a1ae140ef690628125c6e3
BLAKE2b-256 checksum
How to use checksums
c58b2751c35507e0999076b121073e7b0c8e097eede406cf505e7740e02a74a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 28, 2025.

Transparency log

Release files / clapikit-0.1.0-py3-none-any.whl

Download URL clapikit-0.1.0-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a162f097fbf9d62d14ec93db6a7eb7bb21afa3da05f6210e1d36088152fa6e81
BLAKE2b-256 checksum
How to use checksums
560a2a9307505954a78648fcc548fa59a0fbaa8b4ab476b34c0888bfda38dfc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 28, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page