OhMyGPT

Costs

Every response tells you what it cost. Read the charge from the response, look any request up later, and see your full history.

Every response tells you exactly what it cost, so you can track spend per request, per user or per feature without estimating from token counts. Charges are in Credits: 1 USD = 250,000 Credits.

WhereWhat you find
ModelsThe price of every model
UsageEvery request, its model and its cost
BillingYour balance and top-ups

Cost of a non-streaming request

The X-Cost-Credits response header carries the charge, and X-Request-ID identifies the request:

curl -si https://api.ohmygpt.com/v1/chat/completions \
  -H "Authorization: Bearer $OHMYGPT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "zhipu/glm-5.3-flash", "messages": [{"role": "user", "content": "Hi"}]}' \
  | grep -iE '^x-(cost-credits|request-id)'
X-Cost-Credits: 28
X-Request-Id: 01a19b5d-aa2f-71df-a0c2-a97e1d14040b

SDKs hide headers by default. Ask for the raw response:

raw = client.chat.completions.with_raw_response.create(
    model="zhipu/glm-5.3-flash",
    messages=[{"role": "user", "content": "Hi"}],
)
print(raw.headers["x-cost-credits"], raw.headers["x-request-id"])
completion = raw.parse()

Cost of a streaming request

Headers go out before the model has finished, so streams carry the charge as an SSE comment just before the final event:

data: {"id":"...","object":"chat.completion.chunk","choices":[],"usage":{"prompt_tokens":36,"completion_tokens":16,"total_tokens":52}}

: x-cost-credits: 2
data: [DONE]

Chat Completions puts it before data: [DONE], Responses before response.completed, and Anthropic Messages before message_stop. SDKs skip comment lines, so read it if you parse the stream yourself. With an SDK, or on a Gemini stream, look the request up by its ID as shown below.

Look up a request

GET /v1/generation?id=<X-Request-ID> returns the receipt for any of your requests, streaming or not:

curl "https://api.ohmygpt.com/v1/generation?id=01a1a024-b4db-7110-a49f-76360d332aa9" \
  -H "Authorization: Bearer $OHMYGPT_API_KEY"
{
  "data": {
    "object": "request_receipt",
    "id": "01a1a024-b4db-7110-a49f-76360d332aa9",
    "status": "succeeded",
    "created_at": "2026-11-03T06:42:04.462Z",
    "model": { "id": "deepseek/deepseek-v4.1-flash-1017", "provider": "tencent" },
    "usage": {
      "input_tokens": 31,
      "output_tokens": 1,
      "reasoning_tokens": 1,
      "cache_read_tokens": 0,
      "cache_creation_tokens": 0
    },
    "cost": {
      "credits": 3,
      "list_credits": 4,
      "lines": [
        { "kind": "text.input", "quantity": 31, "price_credits": 32850, "list_price_credits": 73000, "credits": 2 },
        { "kind": "text.output", "quantity": 1, "price_credits": 131400, "list_price_credits": 292000, "credits": 1 }
      ]
    },
    "timing": { "duration_ms": 4412 },
    "receipt": { "available": true, "warnings": [] }
  }
}
FieldMeaning
cost.creditsWhat you were charged
cost.list_creditsThe same usage at the model's list price. When it is higher than credits, the difference is what you saved.
cost.linesOne line per priced item: quantity, the unit price you paid (price_credits), the list unit price (list_price_credits), and the line total. Unit prices are Credits per 1,000,000 units.
usageToken counts, including reasoning and cached tokens
model.providerThe provider that served the request
timing.first_token_msTime to first token, on streaming requests

Each line is rounded up to a whole Credit on its own. On a request this small the rounding shows: every unit price above is 45% of list, yet the request paid 3 Credits against 4 at list price. On normal-sized requests the two ratios match.

Keep prompt caching effective

Cached input costs a fraction of fresh input, and your hit rate depends on how your code builds each request. See Prompt caching for what to change and how to measure it.

When your balance runs low

If your balance can't pay for the output limit a request asks for, OhMyGPT lowers the limit to what the balance covers, thinking tokens included, so you still get an answer instead of an error. The response then carries the limit it used:

X-Output-Tokens-Capped: 12000

A stream that sent a keep-alive line before its first output carries it as a comment line ahead of the first event instead: : x-output-tokens-capped: 12000.

Long answers may stop early with the usual length finish reason (length, max_tokens or MAX_TOKENS). Top up on the Billing page to lift the cap. When the balance can't cover even a few thousand output tokens, the request fails with 402 insufficient_credits and the message says how many output tokens the balance can pay for.

Review many requests

To review many requests at once, filter and page through GET /v1/usage, or open the Usage page. GET /v1/usage reads your whole account, so it needs an admin key; turn on Admin key for a key on the API keys page. Other keys get 403 permission_denied.

Every response, errors included, carries an X-Request-ID. Include it when you contact support about a request.

Was this page helpful?

Still stuck? Live chat · [email protected] · Telegram group