Sandbox
@snipeship/ccflare

Multi-provider proxy for Claude and OpenAI

ccflare sits between your agent and Anthropic or OpenAI, then forwards requests by provider prefix without translating the payloads. It adds account-level routing, failover, health checks, request history, and analytics, plus a dashboard and TUI for managing accounts and settings.

1,042 starsโ€ข144 forksโ€ขTypeScriptโ€ขUpdated 5mo ago
Who it's for

Builders who want their agent traffic to go through one proxy with routing, failover, and usage tracking.

What it delivers

You can point Claude Code or OpenAI-compatible clients at one base URL and manage provider accounts from one place.

What it does

Provider prefix routing

Routes requests by `/v1/anthropic/*`, `/v1/openai/*`, and `/v1/ccflare/*`.

Native passthrough

Forwards Anthropic and OpenAI payloads without rewriting them.

Account failover

Retries another account when one provider account is rate limited.

Request history and analytics

Records request summaries, detailed payloads, logs, stats, and aggregated analytics.

Dashboard and TUI

Includes a web dashboard and a terminal UI for managing the proxy and accounts.

OAuth and API key accounts

Supports API key setup and interactive OAuth setup for Claude Code and Codex.

How to get it

  1. 1Verify the server is up
    curl http://localhost:8080/health
  2. 2Use the CLI/TUI for interactive OAuth setup
    # Claude Code OAuth
    bun run ccflare --add-account work --provider claude-code
    
    # Codex OAuth
    bun run ccflare --add-account codex --provider codex
  3. 3Run
    curl -X POST http://localhost:8080/v1/openai/chat/completions \
      -H "content-type: application/json" \
      -d '{
        "model": "gpt-4o-mini",
        "messages": [
          { "role": "user", "content": "Say hello from ccflare." }
        ]
      }'
  4. 4Run
    curl -X POST http://localhost:8080/v1/openai/responses \
      -H "content-type: application/json" \
      -d '{
        "model": "gpt-4o",
        "input": "Summarize why provider-prefixed routing is useful."
    }'
  5. 5Run
    curl -X POST http://localhost:8080/v1/ccflare/openai/chat/completions \
      -H "content-type: application/json" \
      -d '{
        "model": "anthropic/claude-sonnet-4",
        "messages": [
          { "role": "user", "content": "Say hello from the compatibility route." }
        ]
      }'

README

ccflare ๐Ÿ›ก๏ธ

A multi-provider native proxy for Anthropic and OpenAI.

ccflare routes each provider by URL prefix, load-balances across multiple accounts, and keeps full request history, rate-limit state, and usage analytics without translating provider payloads.

ccflare Dashboard

Why ccflare?

  • Native passthrough โ€” Anthropic stays Anthropic, OpenAI stays OpenAI
  • Multi-provider routing โ€” route by /v1/{provider}/*
  • Compatibility routes โ€” route by /v1/ccflare/* with family-prefixed models
  • Account failover โ€” retry another account when one provider account is rate limited
  • Built-in observability โ€” dashboard, request history, analytics, logs, and health endpoints
  • Flexible auth โ€” API key and OAuth account support

Quick start

git clone https://github.com/snipeship/ccflare
cd ccflare
bun install

# Start the server + dashboard on http://localhost:8080
bun run start

# Or launch the TUI, which can also start the server
bun run ccflare

Verify the server is up:

curl http://localhost:8080/health

How routing works

ccflare proxies requests by provider prefix:

  • http://localhost:8080/v1/anthropic/*
  • http://localhost:8080/v1/openai/*
  • http://localhost:8080/v1/ccflare/*

Examples:

  • /v1/anthropic/v1/messages โ†’ https://api.anthropic.com/v1/messages
  • /v1/openai/chat/completions โ†’ https://api.openai.com/v1/chat/completions
  • /v1/openai/responses โ†’ https://api.openai.com/v1/responses

The /v1/{provider} prefix is stripped exactly once before forwarding upstream.

Compatibility routes keep the client-facing schema but select a provider family from the model prefix:

  • openai/<model-id> โ†’ prefers codex, then openai
  • anthropic/<model-id> โ†’ prefers claude-code, then anthropic

Examples:

  • /v1/ccflare/openai/chat/completions with "model":"openai/gpt-5.4"
  • /v1/ccflare/openai/responses with "model":"anthropic/claude-sonnet-4"
  • /v1/ccflare/anthropic/messages with "model":"openai/gpt-4o-mini"

Account setup

API key accounts

Add accounts through the management API:

curl -X POST http://localhost:8080/api/accounts \
  -H "content-type: application/json" \
  -d '{
    "name": "anthropic-main",
    "provider": "anthropic",
    "auth_method": "api_key",
    "api_key": "sk-ant-..."
  }'

curl -X POST http://localhost:8080/api/accounts \
  -H "content-type: application/json" \
  -d '{
    "name": "openai-main",
    "provider": "openai",
    "auth_method": "api_key",
    "api_key": "sk-openai-..."
  }'

OAuth accounts

Use the CLI/TUI for interactive OAuth setup:

# Claude Code OAuth
bun run ccflare --add-account work --provider claude-code

# Codex OAuth
bun run ccflare --add-account codex --provider codex

The management API also exposes provider-specific auth endpoints:

  • POST /api/auth/anthropic/init
  • POST /api/auth/anthropic/complete
  • POST /api/auth/openai/init
  • POST /api/auth/openai/complete

Provider configuration

Anthropic clients

Point Anthropic SDKs or curl at the Anthropic-prefixed base URL:

export ANTHROPIC_BASE_URL=http://localhost:8080/v1/anthropic

OpenAI clients

Point OpenAI-compatible clients at the OpenAI-prefixed base URL:

export OPENAI_BASE_URL=http://localhost:8080/v1/openai

You can configure both providers at the same time and ccflare will keep account selection isolated per provider.

Example usage

Anthropic example

curl -X POST http://localhost:8080/v1/anthropic/v1/messages \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-3-7-sonnet",
    "max_tokens": 128,
    "messages": [
      { "role": "user", "content": "Say hello from ccflare." }
    ]
  }'

OpenAI chat completions example

curl -X POST http://localhost:8080/v1/openai/chat/completions \
  -H "content-type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "messages": [
      { "role": "user", "content": "Say hello from ccflare." }
    ]
  }'

OpenAI Responses API example

curl -X POST http://localhost:8080/v1/openai/responses \
  -H "content-type: application/json" \
  -d '{
    "model": "gpt-4o",
    "input": "Summarize why provider-prefixed routing is useful."
}'

ccflare compatibility example

curl -X POST http://localhost:8080/v1/ccflare/openai/chat/completions \
  -H "content-type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-4",
    "messages": [
      { "role": "user", "content": "Say hello from the compatibility route." }
    ]
  }'

Management API

Key endpoints:

  • GET /health โ€” status, account count, strategy, supported providers
  • GET /api/accounts โ€” list accounts
  • POST /api/accounts โ€” create an account
  • PATCH /api/accounts/:id โ€” update an account (rename, change base_url)
  • DELETE /api/accounts/:id โ€” remove an account
  • POST /api/accounts/:id/pause / resume โ€” exclude or restore an account
  • POST /api/accounts/:id/rename โ€” rename an account
  • GET /api/requests โ€” recent request summaries
  • GET /api/requests/detail โ€” detailed request info with payloads
  • GET /api/requests/stream โ€” live request stream via SSE
  • GET /api/analytics โ€” aggregated analytics
  • GET /api/stats โ€” usage and performance stats
  • POST /api/stats/reset โ€” reset usage statistics
  • GET /api/logs/stream โ€” live server logs via SSE
  • GET /api/logs/history โ€” historical log entries
  • GET /api/config โ€” current configuration
  • GET /api/config/strategy โ€” current load balancing strategy
  • POST /api/config/strategy โ€” update load balancing strategy
  • GET /api/strategies โ€” list available strategies
  • GET /api/config/retention โ€” data retention settings
  • POST /api/config/retention โ€” update data retention settings
  • POST /api/maintenance/cleanup โ€” run data cleanup
  • POST /api/maintenance/compact โ€” compact the database

UI and developer tools

  • Dashboard: http://localhost:8080
  • TUI: bun run ccflare
  • Server only: bun run start

Requirements

  • Bun >= 1.2.8
  • Anthropic and/or OpenAI credentials

Documentation

Additional repo docs live in docs/:

License

MIT โ€” see LICENSE.

Files in the repo

Repository payloadโ€ข16 top-level entries
  • apps
  • docs
  • packages
  • .biomeignore
  • .env.example
  • .gitattributes
  • .gitignore
  • .jscpd.json
  • AGENTS.md
  • biome.json
  • bun.lock
  • CLAUDE.md
  • LICENSE
  • package.json
  • README.md
  • tsconfig.json

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More tools

JuliusBrussee/
caveman

๐Ÿชจ why use many token when few token do trick โ€” Claude Code skill that cuts 65% of tokens by talking like caveman

105k
1 add
MemPalace/
mempalace

The best-benchmarked open-source AI memory system. And it's free.

59k
stablyai/
orca

Orca is the ADE for working with a fleet of parallel agents. Run any coding agent with your own subscription. Available on desktop, mobile and remote runtime.

66k

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

132k

Never stop coding. Free MIT AI gateway: one endpoint, 352 providers (150+ free), 1200+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 550+ contributors

64k
headroomlabs-ai/
headroom

Compress tool outputs, logs, files, and RAG chunks before they reach the LLM. 20% fewer tokens for coding agents, 60-95% fewer tokens for JSON, same answers. Library, proxy, MCP server.

71k