KeyGood / Docs

Quick start

Protect OpenAI spend with virtual keys and hard budget limits.

Quick Configuration Example

Base URL:
https://your-domain.com/api/v1/openai
API Key:
kg_live_xxxx
Model:
gpt-4o-mini

Replace the API key with your virtual key from the dashboard. Only models on the KeyGood pricing table are supported.

Environment / client config

OPENAI_BASE_URL=https://your-domain.com/api/v1/openai
OPENAI_API_KEY=kg_live_xxxx
  1. Sign up

    Create an account and sign in to the dashboard.

  2. Bind your OpenAI API key

    Settings → save your master key. It is encrypted (AES-256-GCM) and never shown again.

  3. Create a virtual key

    Set daily/monthly budgets, optional model allowlist and expiration. Copy the key once — only a hash is stored.

  4. Point your client at KeyGood

    Use the Base URL above and your kg_live_... key. Same paths as OpenAI, e.g. /chat/completions. Streaming is supported.

  5. Hard Stop

    When the budget is exhausted, the API returns 402 with budget_exceeded — the provider is not called.