Skip to main content

Kitty Bridge — launch coding agents through a local API bridge

Project description

kitty-bridge

Use your favorite coding agent with any LLM provider.

Claude Code with MiniMax. Codex with GLM. Gemini CLI with OpenRouter. One command.

pip install kitty-bridge

Quick Start

1. Install

pip install kitty-bridge

Requires Python 3.10+.

2. Set up a profile

kitty setup

An interactive wizard walks you through picking a provider, a model, and entering your API key. Takes 30 seconds.

3. Launch your agent

kitty claude      # Claude Code → your provider
kitty codex       # Codex CLI → your provider
kitty gemini      # Gemini CLI → your provider
kitty kilo        # Kilo Code → your provider

That's it. Your coding agent now talks to the LLM you chose — not the one it was built for.

Example: Use GLM with Claude Code

$ pip install kitty-bridge
$ kitty setup
  ? Provider: openai
  ? Model: openai/gpt-5.4-pro
  ? API key: ********

$ kitty claude
   Bridge running on port <random_port>
   Claude Code launched
  > Hello! How can I help you today?

Example: Use Gemma 4 31B with Claude Code

$ pip install kitty-bridge
$ kitty setup
  ? Provider: Google AI Studio
  ? Model: gemma-4-31b-it
  ? API key: ********

$ kitty claude
   Bridge running on port <random_port>
   Claude Code launched
  > Hello! How can I help you today?

Balanced Profiles

A balanced profile combines multiple providers into one. Each request is sent to a randomly chosen healthy provider. If one provider goes down, the others pick up the slack automatically.

Why use it:

  • Cost savings — spread requests across cheaper providers
  • Rate limit resilience — never hit a single provider's limit
  • Fault tolerance — if one provider is down, the others keep working

How to create one:

kitty profile
# → "Create balancing profile" → select 2+ member profiles

Example: Combine MiniMax, Novita, and Z.AI into one balanced profile called my-pool, then use it with any agent:

kitty my-pool claude
kitty my-pool codex

When you run this, each request goes to a random healthy member. If MiniMax returns an error, kitty silently retries on Novita or Z.AI — your agent never sees the failure.

Bridge Mode

Bridge mode starts a standalone OpenAI-compatible API server on your machine. Use it when you want to connect tools that speak the OpenAI API — IDEs, custom scripts, anything that accepts a base URL.

kitty bridge          # use default profile
kitty my-profile bridge   # use a specific profile

Point your tool at http://localhost:<port> and it just works.

Available endpoints:

Endpoint Protocol Used by
POST /v1/chat/completions Chat Completions General purpose
POST /v1/messages Anthropic Messages Claude Code
POST /v1/responses OpenAI Responses Codex
POST /v1/gemini/generateContent Gemini Gemini CLI
GET /healthz Health check Monitoring

Supported Agents

Agent Command What it is
Claude Code kitty claude Anthropic's coding agent
Codex CLI kitty codex OpenAI's coding agent
Gemini CLI kitty gemini Google's coding agent
Kilo Code kitty kilo Open-source coding agent

Supported Providers

Provider Type ID Notes
OpenAI openai
Anthropic anthropic Direct Anthropic Messages API
OpenRouter openrouter Multi-provider router
MiniMax minimax
Novita novita
Z.AI (regular) zai_regular General-purpose endpoint
Z.AI (coding) zai_coding Coding-optimized endpoint
Fireworks fireworks
Google AI Studio google_aistudio Gemini models via OpenAI-compatible endpoint
Ollama ollama Local LLM deployment
OpenCode opencode_go
AWS Bedrock bedrock Uses boto3 SigV4 auth
Azure OpenAI azure Requires deployment name
Google Vertex AI vertex Requires project and location

Commands

Command Description
kitty setup Create your first profile (interactive wizard)
kitty profile Manage profiles (create, delete, set default, list)
kitty doctor Diagnose installation issues
kitty cleanup Restore agent config files after a crash
kitty bridge Start a standalone API server
kitty claude Launch Claude Code with default profile
kitty codex Launch Codex with default profile
kitty gemini Launch Gemini CLI with default profile
kitty kilo Launch Kilo Code with default profile
kitty <profile> <agent> Launch an agent with a specific profile
kitty <profile> bridge Start bridge with a specific profile
kitty --no-validate <profile> <agent> Skip API key validation
kitty --debug <profile> <agent> Enable debug logging to ~/.cache/kitty/bridge.log
kitty --debug-file /path <profile> <agent> Write debug logs to a custom path
kitty --logging <profile> <agent> Enable token usage logging to ~/.cache/kitty/usage.log
kitty --log-file /path <profile> <agent> Write usage logs to a custom path (implies --logging)
kitty --version Print version
kitty --help Print help

Technical Details

How it works

kitty sits between your coding agent and the upstream LLM provider:

Agent (Claude Code / Codex / Gemini / Kilo) → kitty bridge → upstream provider

When you run kitty claude:

  1. kitty reads your profile (provider, model, API key)
  2. Starts a local HTTP bridge on a random port
  3. Configures the agent to send requests to the bridge instead of its default endpoint
  4. The bridge translates each request to the provider's format and forwards it
  5. Responses are translated back to the agent's native format
  6. When the agent exits, kitty restores the agent's config files

Profiles

A profile binds a provider, model, and API key together. Stored in ~/.config/kitty/profiles.json.

kitty setup        # create a profile interactively
kitty profile      # manage existing profiles
kitty my-profile claude  # use a specific profile

Profile names must be 1-32 characters, lowercase letters, numbers, dashes, or underscores. Reserved words like setup, claude, codex, gemini, kilo, profile, bridge cannot be used as profile names.

Pre-flight validation

Before launching, kitty validates your API key with a lightweight test request. If the key is invalid, you get a clear error immediately — not a cryptic failure inside the agent.

kitty --no-validate my-profile claude  # skip validation (e.g. air-gapped/offline environments)

Logging

kitty has two independent logging streams, each with its own flag and optional custom path.

Token usage logs — records prompt/completion token counts per request:

# Default location: ~/.cache/kitty/usage.log
kitty --logging claude

# Custom location
kitty --log-file /tmp/my-usage.log claude

Debug logs — verbose tracing of requests, responses, and protocol translation:

# Default location: ~/.cache/kitty/bridge.log
kitty --debug claude

# Custom location
kitty --debug-file /tmp/my-debug.log claude

Both flags work in launch mode and bridge mode:

kitty --debug --log-file /tmp/usage.log my-profile bridge
kitty --debug-file /tmp/debug.log --logging my-profile codex
Flag What it logs Default path Custom path flag
--logging Token usage ~/.cache/kitty/usage.log --log-file PATH
--debug Request/response tracing ~/.cache/kitty/bridge.log --debug-file PATH

Cleanup

kitty restores agent config files after the agent exits. Three layers of cleanup:

  1. Normal exitfinally block
  2. Crash / SIGTERMatexit handler
  3. SIGKILL / kernel OOM — run kitty cleanup manually

Project structure

src/kitty/
├── bridge/          # HTTP bridge + protocol translation
├── cli/             # Command-line interface
├── credentials/     # API key storage
├── launchers/       # Agent-specific adapters
├── profiles/        # Profile management
├── providers/       # Upstream provider adapters
├── tui/             # Terminal UI components
└── types.py         # Shared types

FAQ

"API Error: Unable to connect to API (ConnectionRefused)"

The agent is trying to connect to a bridge that isn't running. Usually caused by a stale config from a previous crashed session:

kitty cleanup

"API Error: 401" or "token expired or incorrect"

Your API key has expired or been revoked. Run setup again:

kitty setup

"Prompt exceeds max length" (Z.AI error 1261)

The conversation has grown beyond the model's context window. Use /clear in the agent to reset.

Can I use kitty with Cursor, Windsurf, or other IDEs?

Yes — start a bridge, then point your IDE's "OpenAI base URL" setting at http://localhost:<port>:

kitty bridge
# Then configure your IDE to use http://localhost:<port>/v1/chat/completions

Can I run a local model?

Yes. Install Ollama, pull a model, then create a profile with provider ollama:

kitty setup
# Provider: ollama
# Base URL: http://localhost:11434/v1
# Model: llama3

Development

pip install -e ".[dev]"
pytest
ruff check .
mypy src/kitty

License

MIT

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

kitty_bridge-0.3.1.tar.gz (206.9 kB view details)

Uploaded Source

Built Distribution

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

kitty_bridge-0.3.1-py3-none-any.whl (128.1 kB view details)

Uploaded Python 3

File details

Details for the file kitty_bridge-0.3.1.tar.gz.

File metadata

  • Download URL: kitty_bridge-0.3.1.tar.gz
  • Upload date:
  • Size: 206.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kitty_bridge-0.3.1.tar.gz
Algorithm Hash digest
SHA256 2e02472728837ce6c53e842a42151435a27144f448dde4dbee316c58f4c36acb
MD5 34eb3c9c11f0867282adbe588b2de60d
BLAKE2b-256 878cbd7fedf2eec238cacefecf8bb1950857b8f706ce29dd01927afb0c09ea72

See more details on using hashes here.

Provenance

The following attestation bundles were made for kitty_bridge-0.3.1.tar.gz:

Publisher: publish.yml on Shelpuk-AI-Technology-Consulting/kitty-bridge

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

File details

Details for the file kitty_bridge-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: kitty_bridge-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 128.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for kitty_bridge-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8f38a18f896330d01a44e66510f6a4b3686fc710c177a0ce9d05fd8db295446e
MD5 7321952ff51162ec93a5503928a9a325
BLAKE2b-256 d04aba61e06bacd0c21f2af50991add547da1ab4e549a4b2a412337dd12402fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for kitty_bridge-0.3.1-py3-none-any.whl:

Publisher: publish.yml on Shelpuk-AI-Technology-Consulting/kitty-bridge

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