Skip to content
BUILD WITH YOUR API

Aimodra API reference
and integration guide.

Connect your application to the providers configured in your workspace.

Aimodra API base URL and auth

Use the Aimodra JSON API at https://api.aimodra.com. Requests use your four-hour and weekly allowance, drawn down at each model’s published input and output rate, including provider-reported cached input.

Start with the Claude Code or Codex CLI guide. For your own application, use the API example and SDK endpoints.

Get your API key

Create a key in API keys. Copy it when it is created; the full secret is shown only once. Keys start with aim_.

Authorization: Bearer YOUR_API_KEY

Keep the key on your application’s server. Revoking a key blocks subsequent requests made with it.

START HERE

Connect coding clients to your API key

Connect Claude Code or Codex CLI to Aimodra in three steps. Both use your Aimodra allowance and model catalog.

  1. Create an account, then check your plan and allowance. If using the trial, complete Telegram verification in your dashboard.
  2. Create an API key. Copy it when shown and keep it private. Replace YOUR_AIMODRA_KEY in the examples with this key.
  3. Choose a configured model below. A model must have a provider route compatible with your client.

The examples configure your coding client. Your Aimodra login password, ChatGPT subscription, and Claude subscription are not API keys. Never put a key in a shared repository.

01 / CLAUDE CODE

Connect Claude Code

Install Claude Code using its official installation guide. Open a terminal in your project and check claude --version.

Set the connection and launch

Claude uses the base address without /v1. These variables apply to the current terminal session; start Claude from that terminal. Use /status to confirm the gateway and credential.

Terminal

Confirm it works

Ask “Reply with hello.” Then check request logs and usage in Aimodra. A successful request should appear under the model you selected.

Keep the connection between sessions

Merge the env values into your user-level ~/.claude/settings.json (Windows: %USERPROFILE%\.claude\settings.json). Preserve existing settings. A settings-file value overrides the same shell variable.

User settings · JSON

Reference: Claude Code gateway configuration.

02 / CODEX CLI

Connect Codex CLI

Follow the official Codex CLI installation guide, then check codex --version.

Add a custom provider

In your user-level ~/.codex/config.toml (Windows: %USERPROFILE%\.codex\config.toml), merge this provider block. If model_providers.aimodra exists, update it instead of adding it twice. Keep your other settings.

config.toml · provider

Set your key and launch

This launch selects Aimodra for the current run while preserving your default provider. The base URL includes /v1, and the wire API is responses.

Terminal

Ask “Reply with hello.” Confirm the model in the CLI and look for the request in Aimodra logs. Set the key again in each new terminal, or provide it through your own secret manager.

Reference: OpenAI custom provider configuration.

Connection troubleshooting

401 / invalid key
Use an active Aimodra key and restart the client from the configured terminal. Revoke and replace an exposed key.
404 / wrong endpoint
Claude base URL has no /v1; Codex base URL ends with /v1. Neither uses /api/chat.
Unknown or unavailable model
Copy an exact configured ID from the catalog. Configured means listed, not guaranteed healthy or compatible with every protocol. Check with support if its native route is unavailable.
429 / allowance or request reservation
Check trial verification, plan expiry, and available allowance in the dashboard. A request may need a temporary reservation larger than the available funds even when confirmed spending is low. Check the required and available amounts in the error; reduce conversation size or the requested output limit. Rejected budget checks are not charged.
Client still uses another account
Launch from the same terminal. In Claude, remove conflicting gateway credential settings and inspect /status. In Codex, include the provider override shown above. Organization-managed settings may restrict custom providers.
Images or compaction fail
Vision requires a working native or assisted route. Remote Responses compaction depends on the provider; the previously tested route did not support it. Do not assume every client feature is available.

For support, include the client version, model, time, and request ID. Leave out API keys and private project content.

Make your first Aimodra request

Replace the key and model ID with values from your Aimodra dashboard, then inspect the request in your logs.

Terminal · cURL
curl https://api.aimodra.com/api/chat \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"model":"YOUR_MODEL_ID","messages":[{"role":"user","content":"Hello!"}]}'

A successful response includes message, model, requestId, and usage with input, output, and total tokens. Review actual requests in Logs.

AI model catalog and token pricing

One catalog, one API. Use the exact model ID in your request. Configured models have an enabled provider; this is not a live health guarantee. Planned models become available after a provider is connected.

Model catalog · USD per 1 million tokens
Model IDTierAvailabilityInputOutput
claude-fable-5Paid plans onlyMost capableConfigured$4.20$6.60
claude-fable-5-1Paid plans onlyMost capableConfigured$4.20$6.60
claude-fable-5.1Paid plans onlyMost capableConfigured$4.20$6.60
claude-haiku-4-5FastestConfigured$1.00$1.00
claude-opus-4-6Most capableConfigured$2.60$4.20
claude-opus-4-7Most capableConfigured$2.60$4.20
claude-opus-4-8Most capableConfigured$2.60$4.20
claude-opus-4.7Most capableConfigured$2.60$4.20
claude-opus-4.8Most capableConfigured$2.60$4.20
claude-opus-5Most capableConfigured$2.60$5.00
claude-sonnet-4-6BalancedConfigured$1.25$2.50
claude-sonnet-5BalancedConfigured$1.60$3.20
composer-2.5-fastFastestConfigured$0.20$0.40
deepseek-v4-1-flashFastestConfigured$0.30$0.60
deepseek-v4-flashFastestConfigured$0.20$0.40
deepseek-v4-proBalancedConfigured$0.30$0.60
gemini-3.1-proBalancedConfigured$1.25$2.50
gemini-3.6-flashFastestConfigured$1.00$1.20
gemini-3.7-flashFastestConfigured$1.00$1.20
gemini-3.8-flashFastestConfigured$1.00$1.20
glm-5-turboFastestConfigured$1.00$1.70
glm-5.2BalancedConfigured$1.20$2.40
glm-5.3BalancedConfigured$1.20$2.40
glm-5.3-flashFastestConfigured$0.30$0.60
gpt-5.4-miniFastestConfigured$1.00$1.10
gpt-5.5Most capableConfigured$5.00$17.00
gpt-5.6-lunaFastestConfigured$0.20$0.40
gpt-5.6-solMost capableConfigured$3.40$5.80
gpt-5.6-terraBalancedConfigured$1.00$1.50
gpt-6-astraPaid plans onlyMost capableConfigured$5.05$9.10
grok-4.5BalancedConfigured$0.30$0.60
grok-4.6BalancedConfigured$0.30$0.60
hy4-previewBalancedConfigured$1.00$1.20
kimi-k2.7-codeBalancedConfigured$1.00$1.10
kimi-k3BalancedConfigured$2.40$4.80
mimo-v2.5FastestConfigured$0.20$0.40
mimo-v2.5-proBalancedConfigured$0.20$0.40
minimax-m3BalancedConfigured$0.20$0.40
qwen3.8-flashFastestConfigured$1.00$1.20
qwen3.8-maxMost capableConfigured$2.85$4.70

Rates are per model. Input and output are priced separately, in USD per 1 million tokens, and are charged against the same dollar allowance. Provider-reported cached input counts as input. Billing uses exact token counts and is rounded up to the nearest millionth of a dollar.

For example, 300,000 input tokens plus 500,000 output tokens on claude-opus-5 costs $0.48 + $2.00 = $2.48. Your plan’s dollar price and four-hour and weekly limits remain unchanged. Planned models cannot be requested or billed yet. A configured model with no published rate bills at $1.666667 per million each way until its rate is listed.

Read the current catalog from GET /api/models. This public endpoint returns configured model IDs and each model’s tier and per-million input and output rate, without provider details.

When multiple providers offer the same model, Aimodra tries another matching provider if the first cannot answer. Customer usage is charged once for the successful response.

The request contract

POSThttps://api.aimodra.com/api/chat
model
Required. An enabled model ID.
messages
Required. 1–30 user/assistant messages, ending with a user message. Each message contains role and content. A single message may be as large as the request body allows.
provider
Optional preferred provider ID, configured by your administrator.
Limits
8 MB request body, up to 8,192 output tokens (2,048 by default), 60 requests per minute, and 8 concurrent requests per account. Rate limits are the same on every plan; a paid plan raises your spending allowance, not your request rate.
Client applications maintain their own conversation history. Chat history in the dashboard is saved to your account. Do not automatically retry timed-out requests: the provider may already have performed billable work.

SDK-compatible endpoints

Use POST /v1/messages for Anthropic Messages, POST /v1/responses for Responses, or POST /v1/chat/completions for OpenAI-style text requests. These endpoints use your Aimodra API key and the same allowance, model routing and billing. GET /v1/models lists configured models.

Authentication: send Authorization: Bearer YOUR_API_KEY or x-api-key: YOUR_API_KEY. For the OpenAI SDK, set base_url to https://api.aimodra.com/v1. For the Anthropic SDK, set base_url to https://api.aimodra.com.

Messages and Responses preserve native tool calls, tool results, thinking blocks and streaming, with an 8 MB request limit. Image support depends on a working native or verified assisted-vision route. Chat Completions shares the same 8 MB request limit but supports text only, at most 30 messages and 8,192 output tokens, and ignores reasoning_effort; it rejects tools, response_format and n above 1. Use Messages or Responses for images, tools, extended thinking and coding clients.

Set stream: true to receive text as the provider generates it. Failover is possible before the first text chunk; once output starts, a failed stream ends with an error rather than switching models or replaying text. Usage is finalized after the provider supplies its usage totals. Interrupted requests may retain a reservation for review.

Images & assisted vision

Attach images in dashboard chat, send Anthropic image blocks to /v1/messages, or send input_image blocks to /v1/responses. Use JPEG, PNG, WebP or GIF. A working vision route must be available.

Verified native routes receive the original image. For other models, an available verified vision model can describe the image first; your selected model then answers using that description. This is assisted vision: fine visual details and precise coordinates may be lost. Up to eight images can be analyzed in one assisted request. If no verified helper exists, images are passed to the selected native route without a claim that it supports vision.

Image descriptions remain within the request and are reused during failover. The service covers the helper model’s processing cost; the selected model’s reported usage, including the description as input, counts toward your allowance. Token-counting requests never trigger paid image analysis.

Understand the response

400
Invalid JSON, model, or message format.
401
Missing, invalid, or revoked API key.
429
Rate limit, provider quota, or available allowance reached.
503
Aimodra is temporarily unavailable. The error includes the API base URL, never an upstream provider URL.
504
The provider did not finish within 90 seconds.

Error responses contain an error.message. Unknown provider usage may retain its reservation for review.

Before generation, Aimodra reserves an estimate for input plus the maximum requested output at the selected model’s published rates. This temporary reservation is not the final charge. Reported usage settles the cost and releases unused funds. Confirmed spending and pending reservations appear separately in your dashboard. If a single request needs more than your entire four-hour limit, waiting for that limit to reset will not make the same request fit; use a smaller request or contact support if the estimate looks incorrect. Do not repeatedly retry an unchanged budget rejection.

YOUR NEXT REQUEST

Connect your first model.

Create an API key