BASE_URL='https://api-integration.ollang.com'
curl --no-buffer --fail-with-body \
"${BASE_URL}/integration/real-time-text-translation" \
-H "X-Api-Key: ${OLLANG_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"text": "Hello, how are you?",
"targetLanguage": "Turkish",
"sourceLanguage": "English"
}'
data: {"choices":[{"delta":{"content":"Merhaba, "}}]}
data: {"choices":[{"delta":{"content":"nasılsın?"}}]}
data: {"choices":[{"delta":{},"finish_reason":"stop"}]}
data: [DONE]
Ollang API Reference
Real-Time Text Translation
Translate up to 500 characters with streaming responses and no credit charge during the preview
POST
/
integration
/
real-time-text-translation
BASE_URL='https://api-integration.ollang.com'
curl --no-buffer --fail-with-body \
"${BASE_URL}/integration/real-time-text-translation" \
-H "X-Api-Key: ${OLLANG_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"text": "Hello, how are you?",
"targetLanguage": "Turkish",
"sourceLanguage": "English"
}'
data: {"choices":[{"delta":{"content":"Merhaba, "}}]}
data: {"choices":[{"delta":{"content":"nasılsın?"}}]}
data: {"choices":[{"delta":{},"finish_reason":"stop"}]}
data: [DONE]
Translate up to 500 characters and receive the translation as a stream of server-sent events (SSE). It does not create an order or save a translation deliverable.
Extra request fields are rejected.
Set
The assembled translation is Merhaba, nasılsın?
Existing account access restrictions still apply during the no-credit-charge preview.
No Ollang credits are charged during the temporary preview. A valid Ollang API key is required. This offer applies only to this endpoint and is not a permanent pricing commitment.
Authentication
string
required
Your usual Ollang API key for a client account. Keep the key on your server, not in public browser code.
Request body
SendContent-Type: application/json.
string
required
Source text, from 1 to 500 characters. Empty or whitespace-only text is rejected. Longer input is rejected, not truncated.
string
required
Target language, such as
Turkish. Must contain non-whitespace text and be 1 to 80 characters long.string
Optional source language, such as
English. Omit it to let the model detect the source language. When supplied as a string, it must contain non-whitespace text and be 1 to 80 characters long.OLLANG_API_KEY securely in your environment before running the cURL example.
BASE_URL='https://api-integration.ollang.com'
curl --no-buffer --fail-with-body \
"${BASE_URL}/integration/real-time-text-translation" \
-H "X-Api-Key: ${OLLANG_API_KEY}" \
-H 'Content-Type: application/json' \
-d '{
"text": "Hello, how are you?",
"targetLanguage": "Turkish",
"sourceLanguage": "English"
}'
Streaming response
A successful response has HTTP status200 and content type text/event-stream. Read the response incrementally; it is not a single JSON document.
The following excerpts show text arriving in two events, followed by completion. Additional metadata is omitted for readability.
data: {"choices":[{"delta":{"content":"Merhaba, "}}]}
data: {"choices":[{"delta":{"content":"nasılsın?"}}]}
data: {"choices":[{"delta":{},"finish_reason":"stop"}]}
data: [DONE]
Reading the stream
- Append each
choices[0].delta.contentstring to assemble the translation. Events without text, including role, finish, and usage events, are not translation text. - Buffer incomplete SSE events across network reads. A network chunk is not necessarily one complete event or one complete UTF-8 character.
[DONE]marks the end of the stream. Usage events may precede it and report tokens, not Ollang credit deductions.- Inspect
finish_reason; alengthfinish indicates truncated output. - A disconnect cancels the translation. If the stream ends without
[DONE], treat it as incomplete. Errors after streaming starts may terminate the connection rather than return a new HTTP status.
Preview limits and errors
The preview has shared capacity limits. If you receive429, wait before retrying and reduce concurrent requests. Requests may time out; if the stream ends without [DONE], do not treat the partial output as a complete translation.
| Status | Meaning |
|---|---|
400 | Invalid request body, including text longer than 500 characters. |
401 | Missing, expired, or unrecognized API key. |
403 | Your account is not permitted to access this endpoint. |
429 | Translation capacity or rate limit reached. Retry later. |
502 | Translation failed. Try again later. |
503 | Translation is temporarily unavailable. |
504 | Translation timed out before the stream started. |
Was this page helpful?