Skip to main content

Unified interface to AI CLIs (Gemini, Claude, Codex) from Python or HTTP

Project description

C3 Invoke

Unified interface to AI CLIs (Gemini, Claude, Codex) from Python or HTTP.

Installation

pip install c3-invoke            # Core library (zero dependencies)
pip install c3-invoke[server]    # With FastAPI HTTP server

Quick Start

from c3_invoke import GeminiProvider, ClaudeProvider, parse_json_output
from c3_invoke.types import PromptRequest

# Call any AI CLI with a unified interface
gemini = GeminiProvider()
response = gemini.run(PromptRequest(prompt="Explain Python decorators"))
print(response.raw_output)

# Parse JSON from CLI output (handles markdown fences, embedded JSON)
data = parse_json_output(response.raw_output)

# Run multiple prompts in parallel
from c3_invoke import run_batch
responses = run_batch(gemini, [
    PromptRequest(prompt="Explain decorators"),
    PromptRequest(prompt="Explain generators"),
], max_workers=4)

Providers

Provider CLI Binary Status
GeminiProvider gemini Fully implemented
ClaudeProvider claude Fully implemented
CodexProvider codex Fully implemented
from c3_invoke import get_provider, list_providers

# Get a specific provider
provider = get_provider("claude")

# List all providers with availability status
for info in list_providers():
    print(f"{info.display_name}: {'available' if info.available else 'not found'}")

HTTP Server

pip install c3-invoke[server]
c3-invoke-server    # Starts on port 8766
Endpoint Method Description
/health GET Server status + available providers
/providers GET List all providers with availability
/providers/{name}/test GET Test specific provider
/prompt POST Send a single prompt to a provider
/batch POST Send multiple prompts in parallel

Example

# Single prompt
curl -X POST http://localhost:8766/prompt \
  -H "Content-Type: application/json" \
  -d '{"provider": "gemini", "prompt": "What is Python?"}'

# Batch prompts
curl -X POST http://localhost:8766/batch \
  -H "Content-Type: application/json" \
  -d '{"provider": "gemini", "prompts": [{"prompt": "Q1"}, {"prompt": "Q2"}]}'

Development

pip install -e ".[dev]"
pytest tests/ -v

Architecture

src/c3_invoke/
├── __init__.py             # Public API: get_provider(), list_providers()
├── types.py                # PromptRequest, PromptResponse, ProviderInfo
├── output.py               # parse_json_output()
├── pool.py                 # run_batch() — parallel execution
├── providers/
│   ├── base.py             # BaseProvider ABC
│   ├── gemini.py           # GeminiProvider
│   ├── claude.py           # ClaudeProvider
│   └── codex.py            # CodexProvider
└── server/                 # Optional FastAPI server
    ├── app.py
    ├── main.py
    └── routers/

Part of C3 Ecosystem

C3 Invoke is a standalone package in the C3 organization ecosystem. C3 Architecture Overview will be available soon.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

c3_invoke-0.1.1.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

c3_invoke-0.1.1-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file c3_invoke-0.1.1.tar.gz.

File metadata

  • Download URL: c3_invoke-0.1.1.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for c3_invoke-0.1.1.tar.gz
Algorithm Hash digest
SHA256 fe8fc45592d14f885823caefa33d15883f688ae68b51b7c3d6ecaa13dc026af6
MD5 5fe32390e945eb0d5e83a315755d254f
BLAKE2b-256 142d510512de27c31999ed66e84e4b5a9ffbb609d05cd3a02c7ba63cbdf5f3a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for c3_invoke-0.1.1.tar.gz:

Publisher: publish.yml on CodeCanvasCollective/c3-invoke

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file c3_invoke-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: c3_invoke-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for c3_invoke-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ef7f7b7232c781257576358e9b26f1e63ffc12616658d48484a1b48af3d51e55
MD5 0c3390a3b7a0f7ebc2f05351a3ff7d51
BLAKE2b-256 6fe24ca0d2f7c9d7f96f94dd412d54655464d8c87a5b872efdeaeb38642200e8

See more details on using hashes here.

Provenance

The following attestation bundles were made for c3_invoke-0.1.1-py3-none-any.whl:

Publisher: publish.yml on CodeCanvasCollective/c3-invoke

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page