Language translation remains one of the most practical applications for large language models, but production pipelines often hit cost and complexity barriers when inputs grow. Long documents, multi-turn localization workflows, and batch processing can inflate token bills quickly on traditional inference platforms. Oxlo.ai removes that friction with a developer-first, request-based pricing model that charges one flat cost per API call regardless of prompt length. Because the platform is fully compatible with the OpenAI SDK, you can build translation services using familiar patterns while keeping budgets predictable.
Why Request-Based Pricing Matters for Translation
Token-based billing penalizes long-context tasks, and translation is inherently long-context. A single legal contract or technical manual can run tens of thousands of tokens. On Oxlo.ai, the cost stays flat per request, which makes full-document translation and iterative agentic refinement economically viable. For teams moving from token-based providers, this can mean substantial savings on high-volume localization pipelines. See the exact structure at https://oxlo.ai/pricing.
SDK Setup
Oxlo.ai is a drop-in replacement for the OpenAI client. Point your SDK to the Oxlo.ai base URL and use your existing API key.
from openai import OpenAI
client = OpenAI(
base_url="https://api.oxlo.ai/v1",
api_key="YOUR_OXLO_API_KEY"
)
Basic Translation with Chat Completions
A zero-shot translation prompt works out of the box with models such as Qwen 3 32B, which is optimized for multilingual reasoning.
response = client.chat.completions.create(
model="qwen3-32b",
messages=[
{
"role": "system",
"content": "You are a professional translator. Translate the user input from English to Japanese. Preserve formatting and tone."
},
{
"role": "user",
"content": "The API will return a structured JSON response containing the translated fields."
}
]
)
print(response.choices[0].message.content)
Translating Long-Form Documents
Context windows matter when you want to preserve coherence across chapters or code comments. Oxlo.ai offers models like Kimi K2.6 with 131K context and DeepSeek V4 Flash with 1M context, letting you pass entire whitepapers or codebases in one request without chunking logic.
document = open("technical_spec.md").read()
response = client.chat.completions.create(
model="kimi-k2.6",
messages=[
{
"role": "system",
"content": "Translate the following technical document from German to English. Maintain Markdown structure and code blocks."
},
{
"role": "user",
"content": document
}
]
)
With flat per-request pricing, you are not metered for the large input, so you can prioritize translation quality over token economy.
Structured Translation with JSON Mode
For app localization or catalog translation, JSON mode ensures parseable output that fits directly into your build pipeline.
response = client.chat.completions.create(
model="llama-3.3-70b",
response_format={"type": "json_object"},
messages=[
{
"role": "system",
"content": "Translate the values in the provided JSON from Spanish to French. Keep keys identical."
},
{
"role": "user",
"content": '{"title": "Bienvenido", "cta": "Comprar ahora"}'
}
]
)
import json
translated = json.loads(response.choices[0].message.content)
Streaming for Real-Time Translation
For interactive translation UIs, streaming reduces perceived latency. Oxlo.ai supports streaming with no cold starts on popular models.
stream = client.chat.completions.create(
model="deepseek-v3.2",
messages=[
{"role": "system", "content": "Translate from Portuguese to English."},
{"role": "user", "content": user_input}
],
stream=True
)
for chunk in stream:
if chunk.choices[0].delta.content:
print(chunk.choices[0].delta.content, end="")
Choosing the Right Model
Oxlo.ai hosts 45+ models across 7 categories. For translation specifically, consider the following:
- Qwen 3 32B: Multilingual reasoning and agent workflows.
- Llama 3.3 70B: General-purpose flagship with broad language coverage.
- GLM 5: Long-horizon agentic tasks, useful for context-aware localization.
- Minimax M2.5: Strong for code-heavy or technical translations.
- DeepSeek V4 Flash: 1M context for massive documents.
Evaluate based on source language complexity, domain terminology, and context length.
Conclusion
Building a translation layer on Oxlo.ai means using the OpenAI SDK patterns you already know while eliminating the cost uncertainty of token-based billing. Whether you are translating short UI strings or entire research papers, the flat per-request model and deep context windows keep infrastructure simple and costs predictable. Sign up for the free tier to test the API, then scale through Pro, Premium, or Enterprise plans as your volume grows. Visit https://oxlo.ai/pricing for details.
Top comments (0)