Skip to content

Latest commit

 

History

482 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Oh-My-CPA

Manage APIs and OAuth in one place. Visualize requests, cost and usage.

MCP · Visualization · Management


Release CI Stars Docker Pulls CLIProxyAPI License


Live Demo · Install · Features · Agents and MCP · Documentation · 简体中文


The Oh My CPA dashboard, half in the light theme and half in the dark theme

CLIProxyAPI (CPA) is an API gateway: it adapts protocols, holds credentials and proxies requests. Oh My CPA (OMC) is a web console for it. OMC manages the gateway's providers, credentials and configuration, and records the usage and cost of every request, which CPA does not store. It is a single Go binary with the React console embedded and a local SQLite database, runs offline, and signs in with CPA's management key.

Observe

A live dashboard, a year-long token heatmap, and a faceted browser over every request with latency, TTFT, tokens and cost.

Manage

Providers, OAuth sign-in, client keys, quotas, plugins and CPA's config.yaml, as forms or as YAML. Model Square lists the model names clients can call, by maker, with price, recent requests and models.dev specifications.

Price

The cost of a request is fixed when it completes. Prices come from OpenRouter or custom rates, and later price changes do not alter past records.

Automate

A built-in Agent and an MCP server operate the console through declared capabilities. Changes run only after approval.

Screenshots

Request records with latency, tokens and cost per request

Request records
Every request, filterable by model, provider, key, status and cost

Model price book grouped by provider

Cost & usage
A price book matched from OpenRouter, with custom overrides

OAuth credentials with their state and quota

OAuth management
Sign in, inspect quota and configure each credential in one place

AI provider list with enable switches and traffic

AI providers
Endpoints, models, priority and an enable switch enforced by the gateway

The screenshots follow the GitHub theme. The console has light, dark and system modes, each with three built-in palettes and one custom palette.

The dashboard, request records and OAuth management on a phone

Mobile layout. Every page adapts to a narrow screen.

Install

Install with an agent

Paste the following into Claude Code, Codex, Cursor or another coding agent. The agent inspects the machine, picks the matching method and installs it:

Install Oh My CPA for me by following
https://raw.githubusercontent.com/WizisCool/oh-my-cpa/master/docs/install-for-agents.md

Install with Docker Compose

Requires Docker Engine with the Compose plugin and CLIProxyAPI v8.0.0 or later. The commands assume a Linux or macOS shell with curl and openssl. The console's sign-in password is CPA's management key.

Scenario Method
CPA is not deployed yet New install
CPA is deployed with Docker Compose CLIProxyAPI is already installed
CPA is deployed another way Standalone

New install

Save the following as compose.yml in a new directory:

services:
  cli-proxy-api:
    image: eceasy/cli-proxy-api:latest
    restart: unless-stopped
    ports:
      - "127.0.0.1:8317:8317"
    environment:
      MANAGEMENT_PASSWORD: ${CPA_MANAGEMENT_KEY:?}
    volumes:
      - ./config.yaml:/CLIProxyAPI/config.yaml
      - ./auths:/root/.cli-proxy-api
      - ./logs:/CLIProxyAPI/logs
      - ./plugins:/CLIProxyAPI/plugins

  oh-my-cpa:
    image: wiziscool/oh-my-cpa:latest
    restart: unless-stopped
    depends_on:
      - cli-proxy-api
    ports:
      - "127.0.0.1:8080:8080"
    environment:
      OMCPA_CPA_BASE_URL: http://cli-proxy-api:8317
      OMCPA_CPA_MANAGEMENT_KEY: ${CPA_MANAGEMENT_KEY:?}
      OMCPA_MASTER_KEY: ${OMCPA_MASTER_KEY:?}
      OMCPA_DATA_DIR: /data
    volumes:
      - oh-my-cpa-data:/data

volumes:
  oh-my-cpa-data:

In that directory, download CPA's starter configuration, generate the two keys and start both services:

curl -fsSL https://github.com/WizisCool/oh-my-cpa/releases/latest/download/cpa.config.example.yaml -o config.yaml
printf 'CPA_MANAGEMENT_KEY=%s\nOMCPA_MASTER_KEY=%s\n' "$(openssl rand -hex 24)" "$(openssl rand -hex 32)" > .env
chmod 600 .env
docker compose up -d

Open http://127.0.0.1:8080/omc/ and sign in with the CPA_MANAGEMENT_KEY value from .env. Providers and client keys are added in the console; clients send requests to CPA at http://127.0.0.1:8317.

CLIProxyAPI is already installed

Add the service under services: in the Compose file that runs CPA, and merge oh-my-cpa-data: into the top-level volumes: key if one exists. cli-proxy-api is the service name in CPA's own Compose file; replace it if the service is named differently.

  oh-my-cpa:
    image: wiziscool/oh-my-cpa:latest
    restart: unless-stopped
    ports:
      - "127.0.0.1:8080:8080"
    environment:
      OMCPA_CPA_BASE_URL: http://cli-proxy-api:8317
      OMCPA_CPA_MANAGEMENT_KEY: ${OMCPA_CPA_MANAGEMENT_KEY:?}
      OMCPA_MASTER_KEY: ${OMCPA_MASTER_KEY:?}
      OMCPA_DATA_DIR: /data
    volumes:
      - oh-my-cpa-data:/data

volumes:
  oh-my-cpa-data:

Add two lines to .env in the same directory:

OMCPA_CPA_MANAGEMENT_KEY=<CPA's management key in plaintext, not the hash in config.yaml>
OMCPA_MASTER_KEY=<output of: openssl rand -hex 32>

Run docker compose up -d oh-my-cpa, which leaves the CPA container running as it is. Open http://127.0.0.1:8080/omc/ and sign in with the management key.

Standalone

Save the following as compose.yml in a new directory. OMCPA_CPA_BASE_URL is CPA's address as seen from inside the container: the value below reaches a CPA on the same machine that listens on all interfaces, and reaching CPA lists the other cases.

services:
  oh-my-cpa:
    image: wiziscool/oh-my-cpa:latest
    restart: unless-stopped
    ports:
      - "127.0.0.1:8080:8080"
    extra_hosts:
      - host.docker.internal:host-gateway
    environment:
      OMCPA_CPA_BASE_URL: http://host.docker.internal:8317
      OMCPA_CPA_MANAGEMENT_KEY: ${OMCPA_CPA_MANAGEMENT_KEY:?}
      OMCPA_MASTER_KEY: ${OMCPA_MASTER_KEY:?}
      OMCPA_DATA_DIR: /data
    volumes:
      - oh-my-cpa-data:/data

volumes:
  oh-my-cpa-data:

Create .env in the same directory:

OMCPA_CPA_MANAGEMENT_KEY=<CPA's management key in plaintext, not the hash in config.yaml>
OMCPA_MASTER_KEY=<output of: openssl rand -hex 32>

Run docker compose up -d, then open http://127.0.0.1:8080/omc/ and sign in with the management key.

Notes

Important

Back up .env. OMCPA_MASTER_KEY encrypts the database, and the data cannot be read without it.

CPA hands each usage record to a single reader. If another usage tracker reads the same CPA, stop it, or add OMCPA_USAGE_INGEST_MODE: "off" under environment: to use OMC for management only. Other management panels do not conflict.

The installation guide covers the hardened Compose files published with each release, remote access, HTTPS, building from source, upgrades and troubleshooting.

Features

Gateway & providers
  • AI providers: Codex, Claude, Gemini, Meta Muse, xAI, Vertex AI, Gemini Interactions, DeepSeek and OpenAI-compatible services, each with credentials, models, priority, weight, proxy and an enable switch enforced by the gateway.
  • OAuth management: sign in from the console for Codex, Claude, Antigravity, xAI, Kimi, Devin and Meta Muse. Auth files, model lists and quota are managed per credential; model aliases and exclusion rules apply provider-wide. Window capacity is estimated for Codex, Claude and supported Antigravity groups, with the previous cycle shown as a labelled reference.
  • Client keys: create, name and revoke gateway API keys. Names appear in request records and filters.
  • Model catalog: pull model lists straight from upstream providers.
  • Playground: test any routed model with text and images, streamed multi-turn answers and request diagnostics.
  • Plugins: installed plugins, a plugin store, typed settings forms, and the pages plugins register, opened inside the console.
Observability
  • Dashboard: request volume, token throughput, cache hit rate and cost over presets from 15 minutes to 90 days, an all-time window since installation, or any custom range, plus a year-long token heatmap. Statistics are kept permanently; request records roll out of a configurable retention.
  • Model panels: token trend and usage ring by call point or by upstream model, with cost shares.
  • Request records: multi-select facets and full-text search; a detail drawer with duration, TTFT, token breakdown and the raw per-request log. Each record keeps the model the upstream reported serving, and flags the ones where it differs from the model requested.
  • Background collection: usage is ingested by stream or polling whether or not a browser is open.
  • Logs and audit trail: tail the gateway log, read the console's own service log, and review an append-only audit trail with filters and JSON export.
Pricing & cost
  • Request-time snapshots: a request's cost is fixed by immutable price versions when it completes.
  • OpenRouter price book: every served model priced from OpenRouter's public list, including long-context and time-of-day tiers.
  • Linked and custom prices: pin a model to an OpenRouter entry or set custom rates, with tier presets and a calculator.
  • Channel multipliers: scale everything one provider answers, for example a relay billed at 30% of list.
Configuration & security
  • Dual-mode config editor: structured forms, or a Monaco YAML editor that preserves comments.
  • Automatic config backups: an encrypted copy of config.yaml before every change, restorable from the console.
  • Encryption at rest: stored credentials and raw usage messages are AES-GCM encrypted.
  • Audited sensitive actions: revealing keys, downloading auth files and exporting logs are written to the audit log, and refused if that write fails.
  • Offline operation: every asset is embedded in the binary; no CDN is contacted.
  • Personalization: four interface languages, light and dark themes with custom palettes, a deployment time zone, and K/M/B or 万/亿 number units.

Agents and MCP

In the console. On the /agent page, a model routed through CPA answers questions and operates the console: usage and request analysis, providers, OAuth, quota, client keys, configuration and pricing. Reads run directly. Changes are prepared server-side and run only after an Allow in the console. Secrets, tokens and OAuth authorization never enter the model's context.

From an external agent. The same capabilities are available over MCP from the binary itself:

{
  "mcpServers": {
    "oh-my-cpa": {
      "command": "/path/to/oh-my-cpa",
      "args": ["mcp"],
      "env": {
        "OMCPA_SERVER_URL": "https://cpa.example.com/omc",
        "OMCPA_CPA_MANAGEMENT_KEY": "<CPA management key>"
      }
    }
  }
}

An external agent can read state and prepare an operation, but cannot approve it, submit a secret or complete an OAuth sign-in. The management key is administrator-equivalent, so connect only agents trusted with full access to the console. docs/agent-capabilities.md is the contract.

Configuration

Variable Default Purpose
OMCPA_CPA_BASE_URL required CPA's address
OMCPA_CPA_MANAGEMENT_KEY required CPA's management key, and the console's sign-in password
OMCPA_MASTER_KEY required At-rest encryption key (openssl rand -hex 32)
OMCPA_BASE_PATH /omc Sub-path the console is served under
OMCPA_DATA_DIR ./data Directory of the SQLite database; the Compose files set /data
OMCPA_PUBLIC_URL unset The address browsers use; https:// marks the session cookie Secure
OMCPA_USAGE_INGEST_MODE auto off when another service collects this CPA's usage
TZ system zone Server calendar; keep it equal to CPA's. Containers default to UTC

The full reference, with deployment constraints and operational notes, is docs/operations.md.

Architecture

Browser ──▶ Direct listener / existing HTTPS ingress ──▶ Oh My CPA (:8080)
                                                 ├─ Embedded React SPA (/omc/)
                                                 ├─ SQLite WAL (/data)
                                                 └─ Usage collector ──▶ CLIProxyAPI (:8317)
  • Single binary: the React console is embedded in the Go executable.
  • Single replica: SQLite in WAL mode, one process per data directory.
  • Sub-path native: served under /omc by default (OMCPA_BASE_PATH), so it shares a host with CPA.
  • Allowlisted facade: the console never proxies raw CPA responses or arbitrary URLs.

docs/architecture.md has the module map, data flows and invariants.

Documentation

Using OMC

Document Contents
docs/install.md Installation, verification, upgrades, troubleshooting
docs/install-for-agents.md The same install, as steps for a coding agent
docs/operations.md Settings reference and operational notes
docs/ops/sqlite-operations.md Backup, restore and master-key runbook
docs/agent-capabilities.md Agent capability contract and the MCP bridge
docs/cpa-v8-compat.md CPA v8 baseline and configuration relocation
docs/cpamc-parity.md Feature parity with the official CPA management center

Developing OMC

Document Contents
CONTRIBUTING.md Development setup and the verification workflow
AGENTS.md The contract coding agents follow in this repository
docs/architecture.md Module boundaries, data flows and invariants
CONTEXT.md · docs/design.md Domain vocabulary · visual system
docs/releasing.md Tag-triggered Docker Hub and GitHub releases
docs/ops/cloudflare-demo.md How the public demo is deployed

Contributing

Issues and pull requests are welcome. Development needs Go 1.25+, Node.js 22+ and pnpm 11+:

pnpm install --frozen-lockfile
cp .env.example .env
pnpm dev          # Air + Vite with hot reload at http://127.0.0.1:5173/omc/

Run pnpm verify and pnpm check:ui before pushing. CONTRIBUTING.md covers setup and the verification workflow.

Security

Report vulnerabilities privately as described in SECURITY.md, not in a public issue.

Acknowledgements

Oh My CPA is built on CLIProxyAPI, which handles protocol adaptation, credentials and request proxying.

Thanks also to the Linux.do community.

License

MIT

About

Self-hosted control plane & usage observability console for CLIProxyAPI (CPA) — AI providers, client keys, streaming telemetry, and model cost snapshots.

Topics

Resources

Contributing

Security policy

Stars

60 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages