IN ENGLISH · API DOCS

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:

[01]OPENAI-COMPATIBLE ENDPOINTS

The endpoints

The /v1 endpoints that work
EndpointPurposeBilled by
POST /v1/chat/completionsPurpose:Chat, for the models of every vendorBilled by:Tokens
POST /v1/responsesPurpose:The Responses API, OpenAI models onlyBilled by:Tokens, and each web search
POST /v1/embeddingsPurpose:Text embeddingsBilled by:Tokens
POST /v1/images/generations, /edits, /variationsPurpose:Image generation and editingBilled by:Images or tokens, depending on the model
POST /v1/audio/speechPurpose:Text to speechBilled by:Input characters
POST /v1/audio/transcriptions, /translationsPurpose:Speech to textBilled by:Minutes of audio, or tokens for the Gemini model
POST /v1/videosPurpose:Video generation in the shape of OpenAI's video APIBilled by:Seconds of video
POST /v1/completionsPurpose:Legacy text completionBilled by:Tokens
POST /v1/files, /v1/batchesPurpose:OpenAI Batch: chat and embeddings, results within 24 hoursBilled by:Tokens, at 50% of the usual price
POST /v1/moderations, /v1/responses/input_tokensPurpose:Moderation and token countingBilled by:Free
GET /v1/models, /v1/models/{id}Purpose:The model listBilled 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.

[02]OPENAI-COMPATIBLE ENDPOINTS

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:

The gateway's changes to a request body
ChangeWhereWhy
A retired model id is replaced by its successorWhere:Every routeWhy:So an old configuration keeps working; the response has an X-1xai-Model-Alias header
store is set to falseWhere:OpenAI models on chat/completions and responsesWhy:So the request is not stored at the vendor
stream_options.include_usage is switched onWhere:Every stream except responsesWhy:The bill is computed from the last chunk's token counts
max_tokens becomes max_completion_tokensWhere:OpenAI models on chat/completionsWhy:Newer models accept only the second name
The output cap is lowered, or written inWhere:Every token route except responsesWhy:When the balance cannot fund the cap requested (billing)
temperature, top_p and the repetition penalties are removedWhere:OpenAI reasoning models that accept only the default valuesWhy:Instead of the vendor's 400
response_format json_schema becomes json_object, and the developer role becomes systemWhere:DeepSeek modelsWhy: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.

[03]OPENAI-COMPATIBLE ENDPOINTS

Chat: POST /v1/chat/completions

POST /v1/chat/completionscurl
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.
[04]OPENAI-COMPATIBLE ENDPOINTS

Responses: POST /v1/responses

POST /v1/responses · With web searchcurl
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 400 with code invalid_request; call that model on /v1/chat/completions.
  • The web_search tool 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, when max_tool_calls is lower), and after the answer the searches actually made are charged.
  • Function tools (function and custom) are allowed.
  • code_interpreter, file_search, image_generation, computer_use and mcp answer 400 with code hosted_tool_unmetered.
  • background: true answers 400 with code path_unmetered; send the same request without it.
  • Responses are not stored (store is always false), so reading, cancelling or deleting a response by id (/v1/responses/{id}) answers 402 with code path_unmetered.
[05]OPENAI-COMPATIBLE ENDPOINTS

Embeddings: POST /v1/embeddings

POST /v1/embeddingscurl
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.

[06]OPENAI-COMPATIBLE ENDPOINTS

Images: POST /v1/images/generations and edits

POST /v1/images/generationscurl
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"}'
POST /v1/images/edits · An edit, as a multipart formcurl
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 model field, gpt-image-2 is used. In a multipart form the model field is required.
  • Depending on the model, the bill is per image (by size and quality) or by text and image tokens.
  • stream: true on image generation answers 400 with code path_unmetered.
  • Google's image models are not on this route; call them on the native :generateContent route (Gemini).
  • The response is the vendor's own.
[07]OPENAI-COMPATIBLE ENDPOINTS

Audio: speech and transcription

POST /v1/audio/speechcurl
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.mp3
POST /v1/audio/transcriptionscurl
curl 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 of input. The request body may be up to 1 MiB.
  • /v1/audio/transcriptions and /v1/audio/translations: a multipart form with file and model; billed by the length of the audio. A file may be up to 25 MiB.
  • The model gemini-3.5-transcribe also works on /v1/audio/transcriptions with the same form: response_format is json or text only (no verbose_json, srt, vtt or stream), 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.
[08]OPENAI-COMPATIBLE ENDPOINTS

Video

  • Video generation today is served by the model gemini-omni-1.1-flash on the native Gemini route: see Gemini, video.
  • The routes POST /v1/videos, GET /v1/videos/{id}, GET /v1/videos/{id}/content and POST /v1/videos/{id}/remix answer 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 410 with code model_retired. Listing and deleting videos (GET /v1/videos, DELETE) are not available.
[09]OPENAI-COMPATIBLE ENDPOINTS

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.

[10]OPENAI-COMPATIBLE ENDPOINTS

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.