OpenAI-compatible endpoints: chat, Responses, embeddings, images, audio and video
The base URL https://1xai.ir/v1 accepts the paths of OpenAI's own API. A request body reaches the model's vendor untranslated, except for a short list of changes given on this page. The page has one section for each endpoint that works; the ones that do not are on the unsupported-endpoints page.
Last updated:
The endpoints
| Endpoint | Purpose | Billed by |
|---|---|---|
POST /v1/chat/completions | Purpose:Chat, for the models of every vendor | Billed by:Tokens |
POST /v1/responses | Purpose:The Responses API, OpenAI models only | Billed by:Tokens, and each web search |
POST /v1/embeddings | Purpose:Text embeddings | Billed by:Tokens |
POST /v1/images/generations, /edits, /variations | Purpose:Image generation and editing | Billed by:Images or tokens, depending on the model |
POST /v1/audio/speech | Purpose:Text to speech | Billed by:Input characters |
POST /v1/audio/transcriptions, /translations | Purpose:Speech to text | Billed by:Minutes of audio, or tokens for the Gemini model |
POST /v1/videos | Purpose:Video generation in the shape of OpenAI's video API | Billed by:Seconds of video |
POST /v1/completions | Purpose:Legacy text completion | Billed by:Tokens |
POST /v1/files, /v1/batches | Purpose:OpenAI Batch: chat and embeddings, results within 24 hours | Billed by:Tokens, at 50% of the usual price |
POST /v1/moderations, /v1/responses/input_tokens | Purpose:Moderation and token counting | Billed by:Free |
GET /v1/models, /v1/models/{id} | Purpose:The model list | Billed by:Free |
The Anthropic route (POST /v1/messages) is on the same base URL and is described under Anthropic. The account API (/v1/usage, /v1/wallet, /v1/keys) and the realtime client secret (realtime voice) are under /v1 as well.
What the gateway changes in a request
The gateway does not translate a request body: tools, tool_choice, response_format, image and audio parts and reasoning parameters reach the vendor as you sent them. These are the only changes:
| Change | Where | Why |
|---|---|---|
| A retired model id is replaced by its successor | Where:Every route | Why:So an old configuration keeps working; the response has an X-1xai-Model-Alias header |
store is set to false | Where:OpenAI models on chat/completions and responses | Why:So the request is not stored at the vendor |
stream_options.include_usage is switched on | Where:Every stream except responses | Why:The bill is computed from the last chunk's token counts |
max_tokens becomes max_completion_tokens | Where:OpenAI models on chat/completions | Why:Newer models accept only the second name |
| The output cap is lowered, or written in | Where:Every token route except responses | Why:When the balance cannot fund the cap requested (billing) |
temperature, top_p and the repetition penalties are removed | Where:OpenAI reasoning models that accept only the default values | Why:Instead of the vendor's 400 |
response_format json_schema becomes json_object, and the developer role becomes system | Where:DeepSeek models | Why:Those models do not accept the first form |
service_tier with any value other than auto or default answers 400 with code invalid_request, because each model has one published rate.
Chat: POST /v1/chat/completions
curl https://1xai.ir/v1/chat/completions \
-H "Authorization: Bearer 1xai-..." \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.5",
"messages": [{"role": "user", "content": "Hello"}]
}'- The models of all 10 vendors answer on this route; the model id decides the vendor (models).
- Anthropic and Google models are called through that vendor's own OpenAI-compatible endpoint, so what that endpoint supports works here.
- Anthropic prompt caching with
cache_control, extended thinking and citations are available only on the native Anthropic route. - Tools, structured output and image input are under function calling and structured output; streaming under streaming.
- An image, audio or video model on this route answers
400, and the message names the right route.
Responses: POST /v1/responses
curl https://1xai.ir/v1/responses \
-H "Authorization: Bearer 1xai-..." \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-5.5",
"input": "What are three important AI news items today?",
"tools": [{"type": "web_search"}]
}'- OpenAI models only. Another vendor's model answers
400with codeinvalid_request; call that model on/v1/chat/completions. - The
web_searchtool is allowed and is billed per search, at the model's search rate, in addition to tokens. Before the call the price of 3 searches is held (or fewer, whenmax_tool_callsis lower), and after the answer the searches actually made are charged. - Function tools (
functionandcustom) are allowed. code_interpreter,file_search,image_generation,computer_useandmcpanswer400with codehosted_tool_unmetered.background: trueanswers400with codepath_unmetered; send the same request without it.- Responses are not stored (
storeis alwaysfalse), so reading, cancelling or deleting a response by id (/v1/responses/{id}) answers402with codepath_unmetered.
Embeddings: POST /v1/embeddings
curl https://1xai.ir/v1/embeddings \
-H "Authorization: Bearer 1xai-..." \
-H "Content-Type: application/json" \
-d '{"model": "text-embedding-3-small", "input": ["first text", "second text"]}'Billed by input tokens. The response has OpenAI's shape.
Images: POST /v1/images/generations and edits
curl https://1xai.ir/v1/images/generations \
-H "Authorization: Bearer 1xai-..." \
-H "Content-Type: application/json" \
-d '{"model": "gpt-image-2", "prompt": "A cup of tea on a wooden table, morning light", "size": "1024x1024"}'curl https://1xai.ir/v1/images/edits \ -H "Authorization: Bearer 1xai-..." \ -F model="gpt-image-2" \ -F image="@photo.png" \ -F prompt="Make the background white"
- When a JSON request has no
modelfield,gpt-image-2is used. In a multipart form themodelfield is required. - Depending on the model, the bill is per image (by size and quality) or by text and image tokens.
stream: trueon image generation answers400with codepath_unmetered.- Google's image models are not on this route; call them on the native
:generateContentroute (Gemini). - The response is the vendor's own.
Audio: speech and transcription
curl https://1xai.ir/v1/audio/speech \
-H "Authorization: Bearer 1xai-..." \
-H "Content-Type: application/json" \
-d '{"model": "gpt-4o-mini-tts", "voice": "alloy", "input": "Hello, and welcome to 1xAi."}' \
--output speech.mp3curl https://1xai.ir/v1/audio/transcriptions \ -H "Authorization: Bearer 1xai-..." \ -F model="gpt-4o-transcribe" \ -F file="@voice.mp3"
/v1/audio/speech: billed by the number of characters ofinput. The request body may be up to 1 MiB./v1/audio/transcriptionsand/v1/audio/translations: a multipart form withfileandmodel; billed by the length of the audio. A file may be up to 25 MiB.- The model
gemini-3.5-transcribealso works on/v1/audio/transcriptionswith the same form:response_formatisjsonortextonly (noverbose_json,srt,vttorstream), and it is billed by tokens. It takes Telegram and WhatsApp voice notes (ogg/opus) as they are. It does not work on/v1/audio/translations. - Two-way voice has its own guide: realtime voice.
Video
- Video generation today is served by the model
gemini-omni-1.1-flashon the native Gemini route: see Gemini, video. - The routes
POST /v1/videos,GET /v1/videos/{id},GET /v1/videos/{id}/contentandPOST /v1/videos/{id}/remixanswer in the shape of OpenAI's video API and are billed by seconds of video; polling and downloading are free. - The vendor has retired the Sora models; a request naming one answers
410with codemodel_retired. Listing and deleting videos (GET /v1/videos,DELETE) are not available.
Legacy completions: POST /v1/completions
The legacy text-completion route with a prompt field works for the models that still accept it and is billed by tokens like chat. For new work use /v1/chat/completions.
Free routes
POST /v1/moderations, POST /v1/responses/input_tokens, POST /v1/messages/count_tokens, GET /v1/models and polling a video cost nothing. They still need a key and count toward the key's rate limit.
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.