API documentation
AI Master speaks the OpenAI API. Point any OpenAI SDK or tool at the base URL below and use your AI Master key.
- Base URL
https://www.aimaster.cloud/v1- Auth header
Authorization: Bearer sk-…- Format
- JSON in and out; streaming uses server-sent events
Quickstart
1. Create an account and confirm your email. 2. Add funds under Billing. 3. Create a key under API keys. 4. Send a request:
Authentication
Send your key in the Authorization header as a bearer token. Keys start with sk- and are shown only once when you create them. Keep keys on your server; never put them in a web page or mobile app that others can inspect. You can give each key a monthly spending limit and a list of allowed models, and revoke it at any time.
Models
List the models your key can use:
Use the id as the model parameter. Current prices are on the pricing table. The list only contains models your key may use under your data processing setting (see below).
Stable names. aimaster-fast and aimaster-pro always point to our recommended fast and most capable models. When a better model comes out, or one is retired, we move these names and your code keeps working. Use a specific ID such as deepseek-v4-pro when you need one exact model.
Data zones
Every supplier that can serve a model sits in a data zone. Your account decides which zones may process your requests; you choose at sign-up and can change it under Settings → Data processing.
| Regional | Suppliers processing in our Regional zone. Always allowed. |
| External | Suppliers outside it, such as model makers' own APIs (for example in China). Only used if you allowed it. |
| Private | An endpoint in your own cloud account or data centre, set up for your account only. |
You can also limit a single API key to Regional processing when you create or edit it, even if your account allows External. A request is never moved to a zone you have not allowed, not even when a supplier is down. If a model is only available in a zone you have not allowed, the API answers 403 data_policy_blocked.
Each response tells you where it was processed:
Your usage log and CSV export show the same for every request. Where a model has more than one supplier in your allowed zones, a failed supplier is retried on the next one automatically; you are charged once, for the request that succeeds.
Chat completions
POST /v1/chat/completions works like OpenAI's endpoint: messages, temperature, top_p, max_tokens, stop, tools, response_format and stream are passed through to the model.
Streaming
Set "stream": true to receive tokens as server-sent events, ending with data: [DONE]. Add "stream_options": {"include_usage": true} to receive a final chunk with token usage.
Images in messages
Vision models accept OpenAI-style content parts with image_url (a URL or a base64 data URL).
Reasoning models
Reasoning models return their thinking in reasoning_content next to content. Reasoning tokens count as output tokens.
Embeddings
Rerank
Orders documents by relevance to a query. Useful after vector search.
Images
POST /v1/images/generations with prompt, image_size (or OpenAI's size), batch_size (or n), and optionally negative_prompt, num_inference_steps and seed. The response has data[].url. Image links are temporary, so download them promptly. You pay per image.
Text to speech
POST /v1/audio/speech returns audio bytes. Set voice to a preset name such as alex, anna, bella or david, and response_format to mp3, opus, wav or pcm. Priced per million bytes of input text.
Speech to text
POST /v1/audio/transcriptions takes a multipart upload with file and model (up to 25 MB) and returns {"text": "…"}.
Balance
GET /v1/balance returns your balance in US dollars, so your app can warn you before it runs out.
Errors
Errors use OpenAI's format: {"error": {"message", "type", "code"}}. You are not charged for failed requests.
| HTTP | code | What to do |
|---|---|---|
| 400 | invalid_request, invalid_json | Fix the request; the message says what is wrong. |
| 401 | invalid_api_key, missing_api_key | Check the key and the Authorization header. |
| 402 | insufficient_quota | Add funds. The message shows the most the request could cost. |
| 403 | account_suspended, model_not_allowed | Contact support, or allow the model on this key. |
| 403 | data_policy_blocked | The model only runs in a data zone your account or key does not allow. Change Settings → Data processing, or pick another model. |
| 404 | model_not_found | Use an ID from GET /v1/models. |
| 429 | rate_limit_exceeded, key_monthly_limit_reached, upstream_rate_limited | Wait for Retry-After seconds, or raise the key limit. |
| 502 | upstream_error, upstream_unreachable | Temporary. Retry with backoff. |
| 503 | service_unavailable, model_unavailable | Temporary. Retry later or use another model. |
Rate limits and headers
Each account has a requests-per-minute limit (60 by default; ask us for more). Every response includes:
x-request-id | Quote this when you contact support. |
x-ratelimit-limit-requests | Your per-minute limit. |
x-ratelimit-remaining-requests | Requests left right now. |
retry-after | On 429, seconds to wait. |
x-max-tokens-capped | Present when we lowered max_tokens to fit your balance (see below). |
x-data-zone | regional, external or private: where this request was processed. |
x-processing-region | The region of the supplier that served it, for example Singapore. |
How billing works
- You pay per token (or per image, per byte of speech text, or per transcription) at the published price. Usage is taken from what the model reports in
usage. - When a request starts we hold its maximum possible cost from your balance. When it ends we charge the real cost and release the rest. This is why parallel requests can never overspend your balance.
- If you don't set
max_tokensand your balance can't cover the model's maximum output, we lowermax_tokensto what your balance covers and tell you in thex-max-tokens-cappedheader, instead of rejecting the request. - In the rare case a model doesn't report usage, we estimate it from the text and mark the request as estimated in your usage log.
- Your usage page shows every request; you can export it as CSV. Each payment has a numbered receipt.