Skip to main content
POST
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.
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

Send Content-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.
Extra request fields are rejected. Set OLLANG_API_KEY securely in your environment before running the cURL example.

Streaming response

A successful response has HTTP status 200 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.
The assembled translation is Merhaba, nasılsın?

Reading the stream

  • Append each choices[0].delta.content string 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; a length finish 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.
The model is instructed to return only translated text, but output quality and formatting are not guaranteed. Validate output before using it in a production workflow.

Preview limits and errors

The preview has shared capacity limits. If you receive 429, 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. Existing account access restrictions still apply during the no-credit-charge preview.