Billing & usage

Track API usage and spend, and manage your account balance.

How billing works

  • Prepaid balance — top up first, then pay per request based on actual usage
  • Text models: billed per token (prompt, completion and cached prompt are priced separately)
  • Video models: billed on tokens consumed; see the pricing page for rates
  • Balance is checked before each request; an insufficient balance returns 403

Usage APIs

MethodPathDescription
GET/v1/auth/keyBalance and usage summary
GET/v1/generation?id=xxxDetails for a single request
GET/portal/summaryUsage for today and this month
GET/portal/usageUsage history (paginated)
GET/portal/balanceCurrent balance
GET/portal/activity/by-modelUsage grouped by model
GET/portal/activity/by-keyUsage grouped by API key
GET/portal/activity/exportExport as an Excel workbook (requires format=xlsx)

Request details

curl "https://api.eclogue.ai/v1/generation?id=req-abc123" -H "Authorization: Bearer gw-your-key"
{
  "data": {
    "id": "req-abc123",
    "model": "deepseek-chat",
    "total_cost": 0.0015,
    "tokens_prompt": 10,
    "tokens_completion": 25,
    "latency": 1250,
    "finish_reason": "stop"
  }
}

Response headers

Every chat completion response carries usage-related headers:

X-RateLimit-Limit-Tokens: 500000
X-RateLimit-Remaining-Tokens: 495000
X-Dsesnet-Request-Id: eccb83f6ba72b907364afdb656358ec0
X-Usage-Cost-Estimate: 0.00160000

About X-Usage-Cost-Estimate

This header is a rough estimate, not a billing figure. It is computed at the gateway edge from the model's base rate, so it excludes time-of-day pricing, tiered pricing, account-specific rates, cache creation and tool-call charges — your actual bill may differ.

When you need the exact amount, take X-Dsesnet-Request-Id from the same response and call GET /v1/generation?id=<request-id>; its total_cost is what was actually charged. For aggregates use /v1/auth/key or /portal/usage.

Compatibility note: this header was originally called X-Usage-Cost and was renamed to X-Usage-Cost-Estimate on 2026-08-19 so it would not be mistaken for a settled amount. The rename is rolling out across gateway nodes, so some responses may still use the old name — both mean the same thing and both are estimates. If your code parses it, switch to /v1/generation above for exact figures.