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.
| Where | What you find |
|---|---|
| Models | The price of every model |
| Usage | Every request, its model and its cost |
| Billing | Your 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-a97e1d14040bSDKs 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": [] }
}
}| Field | Meaning |
|---|---|
cost.credits | What you were charged |
cost.list_credits | The same usage at the model's list price. When it is higher than credits, the difference is what you saved. |
cost.lines | One 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. |
usage | Token counts, including reasoning and cached tokens |
model.provider | The provider that served the request |
timing.first_token_ms | Time 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 less than fresh input. In a multi-turn conversation, send the same per-conversation value on every turn so repeated prompts keep hitting the cache:
| Endpoint | Field |
|---|---|
| Chat Completions, Responses | prompt_cache_key, or provider.conversation_id (up to 256 bytes) |
| Anthropic Messages | metadata.user_id |
curl https://api.ohmygpt.com/v1/responses \
-H "Authorization: Bearer $OHMYGPT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "openai/gpt-5.4-nano", "prompt_cache_key": "conv-8f2c", "input": "Hi"}'Claude Code sends its session ID on every request, so it works out of the box. A request's receipt shows the cached input in usage.cache_read_tokens.
Review many requests
To review many requests at once, filter and page through GET /v1/usage, or open the Usage page.
Every response, errors included, carries an X-Request-ID. Include it when you contact support about a request.