Billing in Rupiah
Costs come out of a prepaid balance in Rupiah, with no subscription. Each model's prices are on the Models page and in GET /v1/models.
How cost is computed
Cost = regular input tokens × input price + cache read tokens × cache price + cache write tokens × cache write price + output tokens × output price. All prices are in Rupiah per 1,000,000 tokens.
- Token counts are the ones the provider reports in
usage, plus any prompt optimization credit. Theusagenumbers in the response equal what is billed. - Calculations use integers, so the dashboard total equals the sum of the per-request costs.
- When a model has no cache price, cache tokens are billed at the regular input price.
- Only requests that were served are billed. Errors before the first byte (
502,503,504) are not billed.
Balance hold
Before a request is forwarded, part of the balance is held as a guarantee: an upper bound of the input tokens plus max_tokens times the output price. When it finishes, the real cost is deducted and the rest of the hold returns immediately.
- A balance that covers a short answer can still be rejected with
402whenmax_tokens(or the model limit, if empty) is very large. - Concurrent requests hold balance at the same time.
- Worked example: an output price of Rp48,000 per 1 million tokens and
max_tokens: 4096holds about Rp197 for output. A 300-token answer only deducts about Rp14, and the rest returns.
Prompt caching
Many models keep a repeated prompt prefix and read it again at a cheaper cache price.
- Put the fixed parts (system instructions, reference documents) first and the changing parts last.
- Anthropic format: mark blocks with
"cache_control": {"type": "ephemeral"}. - OpenAI format: caching is automatic for long enough prefixes.
prompt_cache_keyis passed through as is. - Cache tokens appear in
usage(cached_tokensorcache_read_input_tokens) and on the Requests page.
Automatic prompt optimization
The gateway may remove meaningless whitespace outside strings in valid JSON inside the prompt. The data means exactly the same, and you are still billed for the prompt size you sent.
- It never runs for requests with
toolsorfunctions, keys created from the Integrations menu, or requests with thex-optimizer: offheader. - Prompt content is not stored; only the credit amount and technique name are logged for billing.
Images and video
- Per-image models:
n × price per image, and only delivered images are billed. - Token-priced image models: input tokens and image output tokens times the per-million-token price.
- Video: the reported duration (at most what you asked for) times the per-second price for the resolution.
- Failed media requests are not billed. Disconnecting does not cancel media generation.
Viewing usage
Every request is recorded on the Requests page (model, tokens, cost, status, x-request-id). The Reports page summarizes by day and model, and both can be downloaded as CSV. Prompt and response content is not stored in billing logs.