TheaimartAIx DOCS
Home Get API key

Limits, caps & scopes

Rate limits protect the platform; optional per-key caps and scopes let you protect yourself.

Rate limits

Each API key is limited to 100 requests/minute by default, shared across all server instances. Exceeding it returns 429 with a rate_limit_error — back off and retry.

Spend caps

Attach a daily and/or monthly USD cap to any key. Once a window’s spend (plus the next call’s estimate) would exceed the cap, the call is rejected with 402 — protecting against a runaway loop draining your wallet.

Tokens-per-minute (TPM)

Optionally cap a key’s tokens per minute. Useful for agents that burst. Over the limit returns 429.

Scoped keys

Restrict a key to specific models and/or modalities (chat, image, tts, audio, embeddings). A request outside the scope returns 403. Combine with caps to issue safe, narrow keys to teammates or CI.

PolicyEffectOn violation
daily_usd / monthly_usdSpend window cap402
tpmTokens per minute429
allowed_modelsModel allow-list403
allowed_kindsModality allow-list403

Policies are configured per key (DB-driven, no redeploy). A key with no policy is unlimited within the global rate limit.

Idempotency

Send an Idempotency-Key header with POST /v1/chat/completions to safely retry a request after a network blip without being billed twice. A repeated non-streaming request replays the original result; streaming requests use the key as a single-use duplicate guard.

curl https://api.aix.theaimart.co/v1/chat/completions \
  -H "Authorization: Bearer $AIX_KEY" \
  -H "Idempotency-Key: 7b3f-unique-per-attempt" \
  -H "Content-Type: application/json" \
  -d '{ "model": "deepseek-ai/DeepSeek-V3.2", "messages": [{"role":"user","content":"hello"}] }'

Last updated July 18, 2026

Was this page helpful?