API base URL
Use this as the OpenAI SDK base_url. For slow image models, point it at a direct API subdomain to avoid proxy read timeouts.
base_url = "https://api.aitransx.com/v1"
AITransX provides chat, image generation and speech synthesis APIs. Use one API key across models and manage usage, logs and access limits from the dashboard.
Try chat, image generation and speech in the browser, then use the examples below to integrate the API.
Configure the unified API endpoint and Bearer key, then select a stable model ID to route requests through AITransX.
Use this as the OpenAI SDK base_url. For slow image models, point it at a direct API subdomain to avoid proxy read timeouts.
base_url = "https://api.aitransx.com/v1"
Every private request must include your API key. Create and manage keys from the dashboard.
Authorization: Bearer aitx-your-key Content-Type: application/json
Only a few common model ID formats are shown below. Check GET /v1/models for currently available models.
GET https://api.aitransx.com/v1/models model = "auto" model = "gpt-5.6-sol" model = "deepseek@deepseek-v4-pro"
Use chat completions for text and multimodal conversations, image generations for image output, and audio speech for text-to-speech.
/v1/chat/completions
Send OpenAI-compatible requests to /v1/chat/completions. The example uses gpt-5.6-sol and supports streaming with stream: true.
curl https://api.aitransx.com/v1/chat/completions \ -H "Authorization: Bearer aitx-your-key" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.6-sol", "messages": [{"role": "user", "content": "Hello"}], "stream": false }'
from openai import OpenAI client = OpenAI( api_key="aitx-your-key", base_url="https://api.aitransx.com/v1", ) completion = client.chat.completions.create( model="gpt-5.6-sol", messages=[ {"role": "user", "content": "Hello"}, ], stream=False, ) print(completion.choices[0].message.content)
/v1/images/generations
Send a model ID and prompt to /v1/images/generations to generate an image from text. The Python SDK example saves the returned b64_json as out.png.
curl https://api.aitransx.com/v1/images/generations \ -H "Authorization: Bearer aitx-your-key" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-2", "prompt": "a premium product render of a white ceramic cup", "size": "1024x1024", "response_format": "b64_json" }'
import base64 from openai import OpenAI client = OpenAI( api_key="aitx-your-key", base_url="https://api.aitransx.com/v1", timeout=140, ) result = client.images.generate( model="gpt-image-2", prompt="a premium product render of a white ceramic cup", size="1024x1024", response_format="b64_json", ) with open("out.png", "wb") as f: f.write(base64.b64decode(result.data[0].b64_json))
/v1/images/generations
Use the same /v1/images/generations endpoint with input_references to edit an image or generate from references. Replace the public image URL in the cURL example; the Python SDK example reads a local reference.png and saves edited.png. Pass input_references through extra_body in the SDK.
Choose a model that supports reference images. PNG, JPEG and WebP are supported; each original image must be 4 MB or smaller before base64 encoding. Include up to four references in array order; some models accept fewer.
curl https://api.aitransx.com/v1/images/generations \ -H "Authorization: Bearer aitx-your-key" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-image-2", "prompt": "Keep the cup shape and change its color to blue", "size": "1024x1024", "response_format": "b64_json", "input_references": [ { "type": "image_url", "image_url": {"url": "https://example.com/reference.png"} } ] }'
import base64 from pathlib import Path from openai import OpenAI client = OpenAI( api_key="aitx-your-key", base_url="https://api.aitransx.com/v1", timeout=140, ) reference_bytes = Path("reference.png").read_bytes() reference_b64 = base64.b64encode(reference_bytes).decode("ascii") reference_url = "data:image/png;base64," + reference_b64 result = client.images.generate( model="gpt-image-2", prompt="Keep the cup shape and change its color to blue", size="1024x1024", response_format="b64_json", extra_body={ "input_references": [ { "type": "image_url", "image_url": {"url": reference_url}, }, ], }, ) with open("edited.png", "wb") as f: f.write(base64.b64decode(result.data[0].b64_json))
/v1/audio/speech
Send text, a voice and an audio format to /v1/audio/speech. A successful request returns an audio file you can save or play, billed at the selected model's character rate.
curl https://api.aitransx.com/v1/audio/speech \ -H "Authorization: Bearer aitx-your-key" \ -H "Content-Type: application/json" \ -d '{ "model": "qwen/qwen-audio-3.0-tts-flash", "input": "Hello from AITransX", "voice": "longanhuan_v3.6", "response_format": "mp3" }' \ --output speech.mp3
from openai import OpenAI client = OpenAI( api_key="aitx-your-key", base_url="https://api.aitransx.com/v1", ) with client.audio.speech.with_streaming_response.create( model="qwen/qwen-audio-3.0-tts-flash", input="Hello from AITransX", voice="longanhuan_v3.6", response_format="mp3", ) as response: response.stream_to_file("speech.mp3")
Enable Web search in the chat composer to let your selected model answer using web sources. Numbered citations let you inspect those sources. Queries are generated automatically; search settings let you choose keywords, source sites and a planning model. Developers can use their own AITransX API key with the Search / Fetch endpoints below to retrieve web content.
/v1/tools/searchquery accepts 1–128 characters. Optional count is 1–50, default 10; need_content requests page content. You can also supply ori_question (the original question) and localization (an IP address). DeepSeek tool documentation
curl https://api.aitransx.com/v1/tools/search \ -H "Authorization: Bearer aitx-your-key" \ -H "Content-Type: application/json" \ -d '{ "query": "DeepSeek API search", "count": 5, "need_content": true }'
/v1/tools/fetchurl is one HTTP or HTTPS page address. Search returns a results array; Fetch returns title and content for use in subsequent model requests.
curl https://api.aitransx.com/v1/tools/fetch \ -H "Authorization: Bearer aitx-your-key" \ -H "Content-Type: application/json" \ -d '{ "url": "https://api-docs.deepseek.com/" }'
Clearly self-contained tasks go straight to the chat model and incur only its usage charge. When research is needed, planning, searches, page reads and answers are billed separately for actual usage, with up to three searches and two page reads per answer. Manual keywords and direct reading of specified URLs skip planning. Search and Fetch are billed per successful request with nonempty results; failures, timeouts and empty results have no tool charge. Completed charges remain if a later step fails or is stopped. See the price table for rates and request logs for actual charges. Pricing
The platform provides web search for all enabled chat models. Turn it on in the chat composer; no extra setup is required. If temporarily unavailable, continue chatting with web search turned off or contact support.
Contact supportUse limits to control spend, review metadata logs, and handle normal JSON error responses in clients.
Before production traffic, configure limits per key and monitor request logs from the dashboard.
Dashboard logs keep operational metadata such as model, provider, request usage, cost, latency and status. Prompt, response and audio bodies are not written to disk.
Error responses use normal HTTP status codes and include a JSON error message for client handling.
| Status | Meaning | Suggested action |
|---|---|---|
400content_policy_violation | Image generation was rejected by content safety checks. No charge was incurred. | Revise the prompt or reference images, then submit a new request. |
401 | Missing, invalid or revoked API key | Create a new key or check the Bearer token. |
402 | Insufficient balance or the requested model range is not enabled for this account | Add account balance to enable the full model catalog, or select a currently available model. |
429 | Rate limit or concurrency limit reached | Retry with backoff or increase the key limit. |
503 | No healthy upstream route for the requested model | Check /v1/models, switch model ID or contact support. |
| Endpoint | Purpose | Auth |
|---|---|---|
GET /v1/models | List routable model IDs | No key required |
GET /api/pricing | List public model prices | No key required |
POST /v1/chat/completions | Create a chat completion | Bearer key |
POST /v1/images/generations | Create an image generation | Bearer key |
POST /v1/audio/speech | Generate speech from text | Bearer key |
POST /v1/tools/search | Web search (per request) | Bearer key |
POST /v1/tools/fetch | Page content fetch (per request) | Bearer key |
GET /healthz | Service health check | No key required |
This page is no longer current. Copy any unsaved text, then refresh the page and try again.