Developer Dashboard
Filter this catalog
Showing 24 of 376 items

AvalAI API Pricing ​

📞 Support & Feedback

Need help or found an issue with this documentation? Contact our support team on Telegram: t.me/AvalAISupport

We're here to assist with technical questions, billing inquiries, and documentation improvements.

AvalAI's general policy is 0% fee / no markup over official provider pricing, with any exception disclosed explicitly. The direct Meta routes muse-spark-1.3, muse-image-1.0, and muse-wonder-1.0, and the Moonshot route kimi-k3.1-pro-highspeed, currently carry an additional 15% billing-processing fee to cover AvalAI's extra payment and billing overhead. See the base and billed price breakdown. The fee applies only to the disclosed routes; kimi-k3.1-pro, minimax-m3.1-flash, and muse-spark-open have no additional processing fee in this announcement.

Important

AvalAI pricing is based on standard API token usage, similar to the official Anthropic API, OpenAI API Platform, OpenRouter.ai, and other pay-as-you-go API services. It is not the same as consumer or CLI subscriptions such as Claude Pro/Max or Codex subscriptions, where access may be bundled with a product and usage rules can differ from token-based API billing.

Free credit for new AvalAI users ​

New users can receive up to 200,000 Tomans of free API credit without making a payment:

  • Register with a phone number and verify it: receive 200,000 Tomans in free credit.
  • Register with email first: receive 25,000 Tomans in free credit immediately.
  • Connect and verify a phone later: receive another 175,000 Tomans, bringing the total free signup credit to 200,000 Tomans.

The phone-verification reward tops the account up to a 200,000-Toman total signup credit; it does not add 200,000 Tomans on top of the initial email credit. Create and verify your account in the AvalAI Dashboard, then use the free balance to test supported API models before topping up.

For complete details on all models and their capabilities, please visit our Model Details page.

For implementation patterns that reduce spend across model choice, token budgets, prompt caching, async work, and flex routing, see Cost Optimization.

GPT-6.1 Terra ​

The new OpenAI model gpt-6.1-terra is available from Tier 0 on /v1/chat/completions and /v1/responses. It supports visual reasoning and writing with text/image input and text output; tool calling requires Responses for this model. The announced AvalAI rates are USD per 1 million tokens:

Total request input lengthInputCached inputCache creation inputOutput
Up to and including 272K tokens$1.00$0.05$1.25$5.00
Above 272K tokens$2.00$0.10$2.50$7.50

Exactly 272,000 input tokens stays in the lower tier. Above that boundary, the higher input, cache, and output rates apply to the full request, not only excess input. This pricing threshold is separate from the 922,000-token maximum input and 128,000-token maximum output limits.

Count each input token once as ordinary input, a cache read, or cache creation where separately charged. Use the applicable tier's rates in (ordinary input tokens × input rate + cache-read tokens × cached-input rate + cache-creation tokens × creation rate + output tokens × output rate) / 1,000,000. Output includes billed reasoning tokens. Cache rates do not establish a cache hit, retention period, or supported cache-control parameter.

At the lower tier, 1,000 uncached input tokens and 200 output tokens cost $0.002. With 300,000 uncached input tokens and 1,000 output tokens, the full-request higher tier costs $0.6075. These examples exclude separately charged tools and use USD; convert using the actual returned exchange rate for Toman estimates. The supplied standard rates are half GPT-6.1 Sol's corresponding standard rates.

See the OpenAI provider guide, announcement and request/response examples, and live model catalog for current account limits and pricing metadata.

Models with a Processing Fee ​

muse-spark-1.3 supports /v1/chat/completions, /v1/messages, and partial /v1/responses. muse-image-1.0 supports only /v1/images/generations. Start muse-wonder-1.0 and kimi-k3.1-pro-highspeed with /v1/chat/completions and the model-specific guidance in their provider pages. All four are available from Tier 1.

The additional 15% billing-processing fee is an AvalAI charge added to the applicable base rate to cover extra payment and billing costs. AvalAI remains committed to its general no-markup policy. This disclosed exception covers the three direct Meta models and Kimi Highspeed listed here; it does not automatically apply to partner-hosted Llama, Spark Open, or every model from either provider. The fee may change once the overheads are resolved, with no promised change or removal date.

All rates are in USD, per 1 million tokens for text models and per output image for Image. The base column is the applicable AvalAI base rate. For Wonder, the announced base $1.25/$0.15/$4.25 differs from Meta's currently published $4.00/$0.20/$20.00 input/cached-input/output rates; use the AvalAI rates below for this route.

Model / chargeAvalAI base rateAdditional 15% chargeAvalAI billed rate
muse-spark-1.3: input / 1M tokens$1.25$0.1875$1.4375
muse-spark-1.3: cached input / 1M tokens$0.15$0.0225$0.1725
muse-spark-1.3: output / 1M tokens$4.25$0.6375$4.8875
muse-image-1.0: output / image$0.01$0.0015$0.0115
muse-wonder-1.0: input / 1M tokens$1.25$0.1875$1.4375
muse-wonder-1.0: cached input / 1M tokens$0.15$0.0225$0.1725
muse-wonder-1.0: output / 1M tokens$4.25$0.6375$4.8875
kimi-k3.1-pro-highspeed: input / 1M tokens$4.00$0.60$4.60
kimi-k3.1-pro-highspeed: cached input / 1M tokens$0.20$0.03$0.23
kimi-k3.1-pro-highspeed: cache creation / 1M tokens$8.00$1.20$9.20
kimi-k3.1-pro-highspeed: output / 1M tokens$20.00$3.00$23.00

Billed rate = base rate × 1.15. These billed rates already include the fee: do not add another 15% to them or to fee-inclusive catalog prices. For Spark or Wonder without separately billed cache creation, calculate (uncached input tokens × 1.4375 + cached input tokens × 0.1725 + output tokens × 4.8875) / 1,000,000, where uncached input excludes cache hits. For Highspeed, use (ordinary input tokens × 4.60 + cache-read tokens × 0.23 + cache-creation tokens × 9.20 + output tokens × 23.00) / 1,000,000; count each input token in its applicable billing category once. For Image, calculate output images × 0.0115; 100 images cost $1.15 at these rates. Zero token-rate fields do not mean free image generation.

When reading /public/models, use the text model's nested pricing rates and Image's pricing.output_cost_per_image for billed prices. Do not substitute upstream/base fields or interpret an image accounting pricing.output value as the per-image charge. Cache-read rates apply only to actual cache hits; cache creation is a separate category and a listed rate does not establish cache lifetime or control parameters. USD-to-Toman conversion and authoritative final accounting remain as described in Cost Tracking.

See the Meta provider guide, Kimi Highspeed guide, October 25 model announcement, original Meta announcement, and official Meta pricing. This authored breakdown is separate from the generated model overview below.

Gemini 4 Argon ​

The new Google flagship gemini-4-argon supports native Gemini /v1beta/models, /v1/chat/completions, /v1/messages, and /v1/responses. Its rates are USD per 1 million tokens:

Pricing periodInputCached inputOutput
Promotional through November 30, 2026 inclusive — 2026-11-30 (1405-09-09)$2.00$0.10$10.00
Standard from December 1, 2026 — 2026-12-01 (1405-09-10)$4.00$0.20$20.00

The promotional rates are half the standard rates. Cached-input prices apply only to cache-hit tokens; other input uses the input rate. Hidden reasoning is charged as output, and separately billed tools are not included in these token prices. The generated current catalog below displays the active snapshot, while this section also documents the announced future standard rates. Use the live catalog to confirm active pricing and account limits before a long-running workload.

See the Argon and DeepSeek release, Google provider guide, and reasoning guidance.

DeepSeek Flash: unchanged pricing after the base upgrade ​

deepseek-flash and deepseek-v4.1-flash now both use DeepSeek-V4.1-Flash-1017. No client-side code changes are necessary and pricing is unchanged. Keep the current AvalAI ID, endpoint, and request format; the base-model name is not a new API model ID. The upgrade does not announce other alias or endpoint changes.

AvalAI model IDInputCached inputOutput
deepseek-flash$0.15$0.003$0.60
deepseek-v4.1-flash$0.15$0.003$0.60

These USD-per-million-token rates remain fixed around the clock. No scheduling, peak-hour doubling, or further halving applies. Cache-hit tokens use the cached-input rate, and other input uses the input rate. See the DeepSeek provider guide and automatic upgrade announcement.

Claude Haiku 5.5 ​

The new Anthropic model claude-haiku-5-5 supports v1/chat/completions, v1/messages, and v1/responses. Its AvalAI rates are USD per 1 million tokens:

Total request input lengthInputCached inputCache creation inputOutput
Up to and including 100K tokens$0.10$0.01$0.20$0.50
Above 100K tokens$0.50$0.05$1.00$2.50

Exactly 100K input tokens stays in the lower tier. Total request input length determines all applicable rates, including output; this is not a marginal surcharge on only excess tokens. The threshold is a pricing boundary, not a context-window limit.

AvalAI cache creation costs $0.20 / $1.00, rather than the upstream $0.125 / $0.625 cache-write rates. These prices do not establish cache lifetime. This release note is separate from the generated catalog below until the local model snapshot includes the complete record; check the live catalog for current context, output, and account-tier limits. Anthropic's Claude Max/Team credits and accompanying Sonnet discount are not AvalAI billing changes announced here.

See the Haiku 5.5 announcement, provider guide, and reasoning guidance.

Get the Live Model Catalog ​

Use the public endpoint to retrieve the current model list and its pricing metadata. It requires no API key. The response includes the same model IDs and nested pricing fields used by this page.

bash
# Save the response to models.json instead of printing it to the terminal.
curl --fail --silent --show-error \
  https://api.avalai.ir/public/models \
  --output models.json
powershell
# Windows PowerShell: save the response to models.json
Invoke-RestMethod -Uri "https://api.avalai.ir/public/models" `
  -OutFile "models.json"
python
import requests

response = requests.get(
    "https://api.avalai.ir/public/models",
    timeout=30,
)
response.raise_for_status()
models = response.json()["data"]

for model in models:
    print(model["id"], model.get("pricing", {}))
    # Rate limits for your account tier (e.g. tier 2)
    tier_limits = model.get("tier_rate_limits", {}).get("2", {})
    print(
        "  tier 2:",
        tier_limits.get("max_requests_per_1_minute"),
        "RPM",
        tier_limits.get("max_tokens_per_1_minute"),
        "TPM",
    )

Response shape ​

The top-level response is a model list:

json
{
  "object": "list",
  "data": [
    {
      "id": "example-model",
      "object": "model",
      "owned_by": "provider",
      "min_tier": 0,
      "mode": "chat",
      "pricing": {
        "input": 1.25,
        "input_above_128K": 2.5,
        "cached_input": 0.125,
        "output": 10.0,
        "output_above_128K": 15.0
      },
      "max_input_tokens": 200000,
      "max_output_tokens": 32000,
      "max_requests_per_1_minute": 1000,
      "max_tokens_per_1_minute": 2000000,
      "tier_rate_limits": {
        "0": {
          "max_requests_per_1_minute": 1,
          "max_tokens_per_1_minute": 40000
        },
        "1": {
          "max_requests_per_1_minute": 50,
          "max_tokens_per_1_minute": 500000
        },
        "2": {
          "max_requests_per_1_minute": 250,
          "max_tokens_per_1_minute": 1000000
        },
        "3": {
          "max_requests_per_1_minute": 1000,
          "max_tokens_per_1_minute": 2000000
        }
      },
      "supported_endpoints": [
        "/v1/chat/completions"
      ],
      "supports_vision": true,
      "supports_function_calling": true
    }
  ]
}

Important fields:

FieldMeaning
idExact model name to send in API requests and the model's documentation route.
owned_byModel owner or provider shown in the pricing catalog.
modeBilling/operation category such as chat, embedding, image_generation, video_generation, audio_transcription, audio_speech, ocr, rerank, or search.
min_tierMinimum AvalAI account tier required for access. The tier_rate_limits object always starts at this tier.
pricing.input, pricing.cached_input, pricing.outputUSD price per 1 million tokens.
pricing.*_above_*Dynamic long-context rate after the token threshold embedded in the key, such as input_above_128K.
pricing.input_cost_per_pageOCR processing cost per page.
pricing.input_cost_per_annotation_pageOCR annotation cost per page.
pricing.output_cost_per_image_*Per-image price; a suffix identifies a resolution or quality variant.
pricing.output_cost_per_video_per_second_*Per-second video price; a suffix identifies a resolution.
max_input_tokens, max_output_tokensPublished input and output token limits when available.
max_requests_per_1_minute, max_tokens_per_1_minuteThe model's highest available rate limits (requests per minute and tokens per minute), matching the top tier the model exposes.
tier_rate_limitsPer-tier rate limits keyed by AvalAI account tier ("0"–"5"). Each entry provides max_requests_per_1_minute (RPM) and max_tokens_per_1_minute (TPM) for that tier. Higher tiers unlock higher throughput.
supported_endpointsAPI routes supported by the model.
supports_*Capability flags such as vision, function calling, audio, PDF input, caching, and structured output.

Pricing fields vary by model mode. Always inspect the complete pricing object instead of assuming every model has only input and output token rates. Rate limits vary by your account tier; use tier_rate_limits to plan throughput for your own tier rather than assuming the top-level maximum.

How Billing Is Calculated ​

Use the tables below for planning, then verify production spend with the User API because final cost can include more than visible output tokens.

Reasoning-token billing: For every provider and model, hidden reasoning_tokens are billed at the selected model's output-token rate even though they are not visible in the response text. When output_tokens already includes reasoning tokens, output_tokens_details.reasoning_tokens is only a breakdown; do not add the two fields or you will double-count the cost. If a route reports visible output and reasoning separately, add those token counts and apply the same output-token rate to both.

  • Model tokens: input, cached input, output, and hidden reasoning tokens are billed according to the selected model and provider.
  • Route features: Responses, Chat Completions, Batch, image, audio, video, and tool workflows may expose different fields, but the billable unit still comes from the model, media unit, provider route, service tier, or tool call.
  • Hosted tools: built-in tools such as web search, file search, hosted containers, and code-interpreter-style runtimes can add separate call, storage, or session charges when enabled for your route.
  • Provider rules: some providers charge cache creation, long-context uplifts, media seconds, image units, or account-tier-specific rates in addition to base token prices.
  • Operational controls: set token budgets, prefer cached prefixes for repeated context, choose service_tier deliberately, and log avalai-request-id so finance and support teams can reconcile exact transactions.

Flex Service Tier ​

The Flex Service Tier offers 50% reduced costs compared to the default tier for select OpenAI models. This pricing tier provides significant savings for high-volume API usage.

⚠️ Important Considerations

The flex service tier has higher latency compared to the default tier. Requests may take longer to process, time out, or fail during processing.

  • For faster processing of API requests, use the default (standard) service tier ("default")
  • For lower prices with higher latency, use the flex processing tier ("flex")
  • Server timeout: Flex requests may take up to 900 seconds (15 minutes) to complete
  • Production usage: For time-sensitive applications, we recommend implementing a retry mechanism with fallback to service_tier: "default"
  • Priority compatibility: OpenAI examples may mention service_tier: "priority"; use default on AvalAI unless priority processing is explicitly enabled for your account

How It Works ​

  • Default behavior: All requests use the "default" service tier unless otherwise specified
  • Opt-in: Send "service_tier": "flex" in your request to use flex pricing
  • Model validation: Server rejects requests with service_tier: "flex" for unsupported models
  • Response field: All API responses include a "service_tier" field indicating which tier was used
  • Supported public values: AvalAI's generally available values are "default" and "flex"; treat "priority" as account-specific until documented for your route

Flex Tier Pricing ​

Prices are listed per 1 million tokens. These represent 50% savings compared to default tier pricing.

ModelInput ($/1M tokens)Cached Input ($/1M tokens)Output ($/1M tokens)
gpt-5.2$0.875$0.0875$7.00
gpt-5.1$0.625$0.0625$5.00
gpt-5$0.625$0.0625$5.00
gpt-5-mini$0.125$0.0125$1.00
gpt-5-nano$0.025$0.0025$0.20
o3$1.00$0.25$4.00
o4-mini$0.55$0.275$2.20

Usage Example ​

bash
curl -i https://api.avalai.ir/v1/chat/completions \
  -H "Authorization: Bearer $AVALAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5-mini",
    "messages": [{"role": "user", "content": "Hello!"}],
    "stream": false,
    "service_tier": "flex"
  }'

Example Response:

json
{
  "id": "chatcmpl-123",
  "created": 1765789075,
  "model": "gpt-5-mini-2025-08-07",
  "object": "chat.completion",
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "Hi — how can I help you today?",
        "role": "assistant"
      }
    }
  ],
  "usage": {
    "completion_tokens": 123,
    "prompt_tokens": 7,
    "total_tokens": 130
  },
  "service_tier": "flex",
  "estimated_cost": {
    "unit": "0.0001238750",
    "irt": 16.27,
    "exchange_rate": 131350
  }
}

⚠️ Important: Credit Packages and Flex Tier

Credit packages do NOT cover flex service tier costs. When using service_tier: "flex", costs are charged to your default account balance, not deducted from credit package allocations. Credit packages only apply to default service tier usage.

September 11 model pricing update ​

The catalog below includes deepseek-v4.1-flash, grok-4.6, gpt-image-2.5-flare, and gpt-image-2.5-sunburst. Prices in this section are in USD.

  • DeepSeek V4.1 Flash: $0.15 input, $0.003 cached input, and $0.60 output per 1M tokens. These are fixed off-peak rates at all hours; there is no peak surcharge or further halving. Starting September 14, 2026 at 04:00 UTC, deepseek-v4-pro will route to deepseek-v4.1-flash and use these rates. The V4-Pro catalog row describes pre-cutover pricing. Use V4.1 Flash now and test before the change.
  • Grok 4.6: Up to and including 200K input tokens, rates are $2.00 input, $0.50 cached input, and $6.00 output per 1M tokens. Above 200K input tokens, rates are $4.00, $1.00, and $12.50 respectively.
  • GPT Image 2.5 Flare and Sunburst: Both use $5.00 text input, $1.25 cached text input, $8.00 image input, $2.00 cached image input, $0.00 text output, and $30.00 image output per 1M tokens. The zero text-output rate does not make image generation free.

GPT Image 2.5 output-image estimates ​

These estimates apply to one 1024x1024 output image for either model. Add prompt and reference-image input costs to estimate the full request; these are not flat per-edit fees.

Qualitygpt-image-2.5-flaregpt-image-2.5-sunburst
low$0.00588$0.00588
medium$0.01317$0.01317
high$0.05268$0.05268
xhigh$0.09366$0.09366
max$0.21072$0.21072

See the model announcement and migration guidance and Images API cost notes.

GPT-6.1 Sol and Claude Sonnet 5.5 pricing ​

These AvalAI rates are USD per 1 million tokens. Both models are available from Tier 1; see the catalog below for each tier's current throughput limits.

Model and total request input lengthInputCached inputCache creation inputOutput
gpt-6.1-sol, up to and including 272K tokens$2.00$0.10$2.50$10.00
gpt-6.1-sol, above 272K tokens$4.00$0.20$5.00$15.00
claude-sonnet-5-5$2.00$0.20$4.00$10.00

For GPT-6.1 Sol, exactly 272K input tokens stays in the lower tier; total request input length determines both input and output rates. Standard cache reads cost half GPT-6 Sol's cache-read rate. Sonnet 5.5's $4.00 AvalAI cache-creation rate differs from the upstream $2.50 price and does not specify a cache lifetime; no separate long-context tier is listed. Reasoning consumes billed output tokens, so include it in your estimate.

Both models fully support Chat Completions and Messages. Responses support is full for GPT-6.1 Sol and partial for Sonnet 5.5. See the announcement and migration guidance.

Gemini 3.8 TTS promotional pricing and migration ​

These AvalAI rates are USD per 1 million tokens: text input, cached text input, and generated audio output. Output is not priced per second or per file.

Promotional rates: September 30–December 31, 2026, inclusive ​

ModelInputCached inputAudio output
gemini-3.8-flash-tts$0.50$0.125$9.00

Standard rates: from January 1, 2027 ​

ModelInputCached inputAudio output

Choose Flash for creative narration, regional accents, and long-form voice stability; choose Lite for high-throughput voice-agent cascades and read-aloud speech. Flash supports 130 languages and Lite 101, including Persian in both. These rates do not specify cache lifetime, a special account tier, or throughput quotas; consult the catalog for current AvalAI data.

Migrate from gemini-3.1-flash-tts-preview, gemini-2.5-flash-tts, gemini-2.5-pro-tts, or their gemini-2.5-flash-preview-tts / gemini-2.5-pro-preview-tts variants by updating both the request schema and, where necessary, the endpoint. AvalAI exposes 3.8 TTS only through native /v1beta/models methods, /v1/chat/completions, and /v1/audio/speech, not legacy Vertex, Live, Interactions, or additional upstream voice endpoints.

Keep text verbatim and put per-part speaker and style in native camelCase speechMetadata. Native unary 3.8 defaults to WAV; inspect MIME before decoding. Chat requests use audio.format: "pcm16", while Speech can explicitly request response_format: "mp3". Legacy 3.1 supports PCM16 only: do not save raw PCM as MP3 without transcoding. See the announcement with migration and request/response examples.

Model Pricing Overview ​

This catalog is generated from data/models.json, which is the authoritative source for model availability and pricing. Each current model ID appears once. Token prices are per 1 million tokens unless another unit is shown.

Prices labeled above N tokens apply when the provider's billed context crosses that threshold. Media dimensions, quality variants, OCR annotation pages, searches, and other units are listed independently when present. GLM-5.3-Flash promotion: The listed $0.075 input, $0.015 cached-input, and $0.25 output rates apply through September 9, 2026; standard rates after that date are $0.15 input, $0.03 cached input, and $0.50 output. Gemini 3.8 Flash promotion: The listed $0.75 input, $0.075 cached-input, and $3.75 output rates for gemini-3.8-flash and its gemini-flash-latest alias apply through December 31, 2026; standard rates after that date are $1.50 input, $0.15 cached input, and $7.50 output.

The Rate limits column lists the per-minute request (RPM) and token (TPM) ceilings for each AvalAI account tier, sourced from the tier_rate_limits object. Higher tiers unlock higher throughput. Tiers below a model's min_tier are marked No access because the model is not available on those tiers.

Chat, Responses & Completion Models ​

Model IDProviderPricing detailsRate limits

Embedding Models ​

Model IDProviderPricing detailsRate limits

Image Generation Models ​

Model IDProviderPricing detailsRate limits

Video Generation Models ​

Model IDProviderPricing detailsRate limits

Audio Transcription Models ​

Model IDProviderPricing detailsRate limits

Text-to-Speech Models ​

Model IDProviderPricing detailsRate limits

OCR Models ​

Model IDProviderPricing detailsRate limits

Moderation Models ​

Model IDProviderPricing detailsRate limits

Reranking Models ​

Model IDProviderPricing detailsRate limits

Search Models ​

Model IDProviderPricing detailsRate limits

Other Models ​

Model IDProviderPricing detailsRate limits

Built-in Tools ​

Built-in tools are not model IDs and therefore are not sourced from the model catalog. Tokens consumed by a tool are still billed at the selected model's rates.

ToolCostNotes
Code Interpreter$0.03 / session
File Search Storage$0.10 / GB/dayFirst 1 GB free
File Search Tool Call$2.50 / 1,000 callsResponses API

Cost Tracking ​

AvalAI provides two methods for tracking API costs:

1. Estimated Cost (Basic) ​

API responses include an optional estimated_cost dictionary for quick cost estimation:

FieldDescription
unitCost in USD/USDT
irtCost in Tomans (IRT), calculated as USD cost × USDT-IRT exchange rate
exchange_rateCurrent USDT-IRT exchange rate used for the conversion

Example API response with estimated cost:

json
{
  "id": "response-123456",
  "object": "chat.completion",
  "created": 1714911234,
  "model": "gpt-4o",
  "choices": [...],
  "usage": {
    "prompt_tokens": 42,
    "completion_tokens": 128,
    "total_tokens": 170
  },
  "estimated_cost": {
    "unit": 0.0025,
    "irt": 200,
    "exchange_rate": 80000
  }
}

Important notes:

  • This field might not be present in all responses.
  • For regular (non-streaming) requests, it's included in the main response.
  • For streaming requests, it's attached to the last chunk of the streaming response.
  • The estimated cost is not guaranteed and should not be used for billing or accounting purposes.

2. User API (Precise & Guaranteed) ​

For accurate cost tracking and billing, use the User API at https://api.avalai.ir/user/v1:

Key Features:

  • 100% Accurate Costs - Guaranteed precise costs for every API call
  • Request ID Tracking - Use avalai-request-id from response headers to lookup exact costs
  • Available Within 30 Seconds - Costs processed and ready for retrieval
  • Transaction History - Complete audit trail with filtering capabilities
  • Usage Analytics - Detailed summaries by model, provider, date, or hour

Perfect for:

  • Resellers - Accurately charge customers based on actual costs
  • Enterprises - Precise cost allocation and chargeback
  • Production Apps - Reliable billing and usage monitoring

Quick Example:

bash
# 1. Make API call and get avalai-request-id from response headers
curl -i "https://api.avalai.ir/v1/chat/completions" \
  -H "Authorization: Bearer $AVALAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "gpt-4o-mini", "messages": [{"role": "user", "content": "hi"}]}'

# Response includes: avalai-request-id: 019ac4a0-a8f4-7041-845f-3ea8f15dcf1a

# 2. Get precise cost (available within 30 seconds)
curl "https://api.avalai.ir/user/v1/transactions/lookup" \
  -H "Authorization: Bearer $AVALAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"transaction_ids": ["019ac4a0-a8f4-7041-845f-3ea8f15dcf1a"]}'

Learn More: