API billing and pricing
A call costs the model vendor's own USD list price, plus our markup (15% on flagship models, 30% on the small low-cost models, 20% on the rest), times the day's dollar rate in Toman. That amount is taken from a prepaid Toman wallet. 10% VAT is added to every top-up. A failed request is not billed, and credit you buy yourself does not expire.
Last updated:
The formula
cost_toman = usage × vendor_list_price_usd × (1 + markup) × toman_per_usd
usageis tokens, seconds, characters or images, depending on the route.vendor_list_price_usdis the vendor's own published list price. Input, output and cached tokens each have their own rate.- The amount of each call is rounded up, and is at least one Toman.
- Each model's Toman price is on the pricing page and in the model list.
The markup by model
| Tier | Markup | Which models |
|---|---|---|
| Flagship | Markup:15% | Which models:Claude Opus, Fable and Mythos, GPT-5.5, GPT-6 Astra, the -pro models, Gemini Pro, o1 and deep-research |
| Small, low-cost | Markup:30% | Which models:deepseek-v4-flash, gemini-2.5-flash, gemini-2.5-flash-lite, gpt-4o-mini, gpt-5-nano, gpt-5.6-luna, gpt-6-luna |
| Every other model | Markup:20% | Which models:Any other model, including image, audio, video and realtime models |
- Volume rule: an account whose wallet spent more than 5,000,000 Toman in the last 30 days pays at most 15% on every model. It applies automatically.
- These tiers apply from 27 October 2026; before that the markup was 20% on every model.
- The markup does not depend on the route: a model costs the same on
/v1,/anthropicand/gemini.
The dollar rate
The dollar-to-Toman rate is refreshed every day at 9 in the morning, Tehran time, rounded up to the next 100 Toman, and moves by no more than 15% in a day. Today's rate and the time it took effect are printed on the pricing page. Each call is priced at the rate of that moment, and the rate used stays on that call's usage row. The wallet balance is in Toman and does not move with the rate.
Top-ups and VAT
| What | Value |
|---|---|
| Payment methods | Value:the Zarinpal gateway, the Digipay gateway and card-to-card transfer with a receipt |
| Smallest top-up | Value:1,000 Toman |
| Largest top-up | Value:25,000,000 Toman |
| VAT | Value:10%, added on top of the amount |
| Card-to-card bonus | Value:10% extra credit |
- VAT is added on top: the amount you choose is what reaches the wallet, and the VAT is paid in addition to it. The checkout shows the base amount, the VAT and the total before sending you to the gateway.
- The smallest and largest amounts are the same for every method. For a larger amount, use the contact form.
- A gateway payment reaches the wallet at once. A card-to-card transfer is confirmed after its receipt is reviewed.
- Top-ups are made in the dashboard, on the top-up page (in Persian). There is no API to top up.
The hold before each call
- Before a request is sent, its largest possible cost (the prompt plus the output cap) is held from the balance. After the answer, the real cost is charged and the rest of the hold is released at once.
- When
max_tokensasks for more than the balance can fund, the request is not refused: the gateway lowers the output cap to what the balance affords and makes the call. The answer may then end withfinish_reason: "length". - When you send no output cap and the balance cannot fund the default one, the gateway writes in a cap of up to 4,096 tokens.
- A
402with codeinsufficient_balanceis returned only when the balance cannot fund even the prompt plus one output token. /v1/responsesis the exception: its output cap is never rewritten.- An OpenAI batch (
POST /v1/batches) has a hold of its own: the whole file's estimated maximum plus 10%, from the wallet only, until the batch is settled (the batch hold).
Failed, cut and partial calls
| Case | Billed |
|---|---|
| A successful answer | Billed:The usage the vendor reports |
An error from the gateway or the vendor (a 4xx or 5xx status) | Billed:Nothing; it is only recorded |
| You close the connection in the middle of a stream | Billed:In full: generation runs to its end on the vendor's side |
| The vendor gives no answer within 10 minutes | Billed:Nothing |
| An answer was partly delivered and then cut on our side | Billed:Only the delivered part, and never more than the amount held |
| An image or video generation that is cut or fails | Billed:Nothing; refunded if it was charged |
Prompt caching and tools
- Input tokens read from a cache are billed at the model's cheaper cached rate. That holds for the automatic caching of OpenAI and Gemini, and for Anthropic's
cache_control. - On Anthropic, writing to the cache has its own rate (one for the five-minute cache, one for the one-hour cache), as the vendor prices it.
- Web search is billed per search at the model's search rate, in addition to tokens (hosted tools).
Chat plans and gift credit
- The API is pay-as-you-go and needs no plan. With a paid chat plan, API calls are paid from the plan's credit first, up to 40% of the plan's monthly grant, and from the wallet after that. A free account pays for API calls from the wallet only. See the plans (in Persian).
- A new account spins the gift wheel once: from 100,000 Toman to 1,000,000 Toman of gift credit for the fast, inexpensive models, plus 30,000 Toman for any model. Both are valid for 14 days from the spin and can be spent on API calls.
- Gift credit is not cash: it cannot be withdrawn or refunded, and it has a fixed expiry.
- OpenAI Batch is the exception: a batch is paid from the wallet only, and plan credit and gift credit do not pay for it.
Refunds and credit expiry
- Credit you buy yourself has no expiry date.
- Unused balance can be requested back through the contact form within 30 days of the last top-up. The fee of the gateway you paid with is deducted from the refund.
- The full text is in the terms of service, and that text is the reference.
Reading your own bill
Every call has a row in the usage report with its model, tokens, cached tokens, the USD base price (base_cost_usd) and the Toman amount charged (cost_toman). The same rows are readable with the same key through the account API, a whole date range comes as a CSV file, and the wallet's transactions through GET /v1/wallet/transactions. The non-streamed answer of a billed call also states its amount in the X-1xai-Cost-Toman header (response metadata).
1xAi is an independent gateway. It is not affiliated with, endorsed by, or a reseller for OpenAI, Anthropic, Google, DeepSeek, xAI, Moonshot AI, Z.ai, Alibaba Qwen, MiniMax or Tencent Hunyuan. Requests are relayed upstream rather than answered by models of our own, so each provider's own usage policies apply to what their models will and will not do, and their model availability is theirs to change. Current reachability is published on the status page.