Skip to main content
BYO Lite is in beta and enabled per organization. Details can change before general availability.
If your engine already has its own HTTP API, for example an OpenAI-compatible one, you don’t need to build and host an adapter. With BYO Lite you give Phrase a JSON template that describes how to call your engine’s API directly and how to read its response. Phrase runs the template on its side, with the same authentication and retries as for an adapter. There is nothing to develop, deploy or keep running. BYO Lite is meant for engines whose API maps easily to the Phrase BYO schema. The full adapter is for heavier logic, such as custom processing, several upstream calls per request or an API that a template can’t describe.

Prerequisites

  • BYO Lite is enabled for your organization. It is in beta, so to have it enabled, contact your account manager or Phrase support.
  • An engine with its own HTTP API, and its URL and credentials, such as an API key.
  • For a custom template, a JSON template that you wrote, or one you adapted from the pre-built template.

Quickstart

To connect an OpenAI-compatible service with the pre-built template:
  1. In the engine settings, set Engine API to Pre-built template and select OpenAI-compatible.
  2. Under Credentials, enter the Base engine URL, for example https://api.openai.com/v1. Include the API version of your service, see Base engine URL by service.
  3. Set Authentication method to HTTP header. Enter the Header name, usually Authorization, and the Header value, for example Bearer <your API key>. Phrase sends the value exactly as you enter it, so include any prefix such as Bearer .
  4. Optionally add metadata under Custom labels, for example the key model, see Metadata in a template.
  5. Select Validate connection, then Save. Validation uses the settings as they are in the form, so you can run it before you save. See Engine validation test for the checks it runs.
If your engine uses OAuth 2.0 instead, select Client credentials (OAuth 2.0). It works as described in Token request for client credentials.

Ways to connect

In the engine settings, Engine API offers three options. The two template options are marked Lite. Phrase validates the template before the engine is saved.

What works like the full adapter

BYO Lite uses the same engine settings and the same behavior on Phrase’s side as the full adapter. Read these sections of the BYO Engine guide:
  • Authentication: the OAuth 2.0 client credentials option and the token request. For an HTTP header, you enter the header name and value yourself, see the Quickstart.
  • Retries and timeouts: which status codes are retried, and the time limits for each call.
  • Segment counts: how many segments Phrase sends in one call. Use maxSegments if your engine accepts fewer.
  • Dynamic metadata: the placeholders you can use in metadata values.

Template structure

A template is a single JSON file of up to 8 KB. Keys that are not listed here are rejected. A template needs only three blocks:
Each request and response value is a JSONata expression. A request expression builds the request body of your engine from the variables Phrase provides. A response expression reads the translated text out of the engine’s response. For translate, it must return one translated string per segment, in the same order. Wrap a single value in [...] so that one segment still produces a list. See How Phrase reads the responses for what every expression must return. maxSegments is the highest number of segments your engine accepts in one call. If Phrase has more, it splits them into several calls and joins the results in the original order, so the template only ever describes one call. The 500 segments of the engine validation test are split the same way. You can try an expression before you save the template. Paste a sample response of your engine into the JSONata exerciser and run your response expression against it. The exerciser doesn’t know the Phrase variables, such as $segments, or the functions $langOut, $langIn and $fromJson, so replace them with sample values there. An expression that runs longer than 2 seconds fails. Every path in a template (translate, status, languages and the asynchronous blocks) is added to the Base engine URL you enter in the engine settings. With the base URL https://api.example.com and the path /v1/translate, Phrase calls https://api.example.com/v1/translate. If the base URL already ends with a path, such as https://gateway.example.com/openai, the template path is added after it. Repeated slashes are merged, so it doesn’t matter whether either side has a slash at the junction. The following example shows every block:
  • In translateAsyncStatus and translateAsyncResult, {jobId} in the path is replaced with the job ID returned by translateAsync. The doneWhen and failedWhen expressions are evaluated against the status response. While neither matches, Phrase keeps polling. detail is evaluated only when failedWhen matches, and becomes the failure message.
  • headers accepts up to 10 headers with values of up to 256 characters. Authorization, Host, Content-Type, Content-Length, Cookie and X-Phrase-Action-Id can’t be set, because Phrase manages them.
  • The $eval and $error functions are not allowed.

Block reference

These are the fields of the blocks other than translate. Every method is GET or POST. The status and languages calls have no request, so a POST sends an empty JSON object and a GET sends no body. status
  • path, method (required): the health check call.
  • okWhen (required): a JSONata expression evaluated against the engine’s response. The engine counts as healthy when it is true.
languages
  • mode (required): static or endpoint, see Supported languages in a template.
  • path, method, response (required in endpoint mode): the call to your engine, and the expression that reads the languages from its response.
error
  • message (required): a JSONata expression that reads the error message from the engine’s error response.
  • code (optional): a JSONata expression that reads an error code.
translateAsync
  • request, response (required): submits the job. request is built like the one in translate, and response returns the job ID.
  • path, method (optional): default to /translateAsync and POST.
translateAsyncStatus
  • doneWhen (required): a JSONata expression that is true when the job has finished.
  • failedWhen (optional): a JSONata expression that is true when the job has failed. Without it, Phrase keeps polling until the asynchronous time limit runs out.
  • detail (optional): reads the failure message, only when failedWhen matches.
  • path, method, request (optional): default to /translateAsyncStatus/{jobId} and GET, with no body.
translateAsyncResult
  • response (required): reads the translated strings, like translate.response.
  • path, method, request (optional): default to /translateAsyncResult/{jobId} and GET, with no body.

How Phrase reads the responses

Every response, doneWhen, failedWhen, detail, okWhen and error expression is evaluated against the JSON body that your engine returned. These expressions have no Phrase variables, so they can’t use $segments, $source or $meta, but the functions $langOut, $langIn and $fromJson are available. Each one has to return a specific shape: Write okWhen, doneWhen and failedWhen as comparisons, such as status = 'ok' or $exists(character_limit). A bare field such as status returns text, which doesn’t count as true, so the engine would always be reported as unhealthy. Examples. An engine that answers a translation request with this body:
needs "response": "translations.text[]", which returns ["Hallo", "Welt"]. A language model answers with the translations as text inside its reply, so a template parses it with $fromJson:
For the asynchronous flow, Phrase submits the job and then checks the status every few seconds. It stops with an error as soon as failedWhen is true, and checks doneWhen before failedWhen. Without failedWhen, it keeps polling until the time limit in Retries and timeouts runs out. The block example above shows all three asynchronous blocks. Single values and lists. JSONata returns a bare value, not a list, when a path matches exactly once. For translations.text, the same expression gives different results depending on how many segments the call carried: Phrase turns a single string back into a list for translate.response, translateAsyncResult.response and for the codes of languages.response with crossProduct, so both forms work there. It does not do this for language pairs. If your engine could return exactly one language, end the expression with []:
The same effect applies to the request. For one segment, $segments.text is a bare string and not a list. If your engine expects a list, write [$segments.text].

Supported languages in a template

The languages block has two modes. static lists the languages in the template. Use either pairs, a list of { "sourceLanguage", "targetLanguage" } objects, or codes, a flat list of language codes. Phrase combines the codes into all pairs, leaving out same-to-same pairs. You can also add codesFrom, a JSONata expression evaluated against the metadata. When it returns at least one valid language code, or a comma-separated string of codes, those codes replace pairs or codes. This lets you restrict the languages per engine without editing the template.
Use pairs when your engine doesn’t support every combination, for example when it translates only from English, or only into some languages. Phrase offers exactly the pairs you list, in that direction only:
endpoint asks your engine. Phrase calls path with method, and response turns the answer into a list of { "sourceLanguage", "targetLanguage" } pairs. If your engine returns only a flat list of codes, set crossProduct to true and let response return that list. Phrase then builds the pairs itself. Use Phrase locale codes in pairs, codes and codesFrom, for example pt-br. If your engine uses other codes, add them to languageMap, see Mapping language codes.

Mapping language codes

Phrase gives your template locale codes such as pt-br or zh-hans, in $source and $target. If your engine uses different codes, you don’t need to convert them in the request expression. Add a top-level languageMap that maps Phrase codes to your engine’s codes, and call $langOut in the request:
How the map behaves:
  • The keys are Phrase locale codes, and the values are your engine’s codes, sent exactly as written. Keys are matched without regard to case.
  • $langOut(code) converts a Phrase code to an engine code. Several Phrase codes can share one engine code, for example zh-cn and zh-sg can both map to zh.
  • A code that is not in the map is converted to upper case, so ja becomes JA. If your engine expects lower-case codes, or the same code as Phrase, list every code you offer in the map, for example "ja": "ja".
  • $langIn(code) converts an engine code back to a Phrase code. A code that is not in the map is converted to lower case. When several Phrase codes share one engine code, $langIn returns only one of them.
  • Both functions are available in every expression of the template.
Use the map for the codes that differ from Phrase’s. If one rule covers all of them, put the rule in the expression instead, for example $lowercase($target) for lower-case codes, or $split($target, '-')[0] for the base language without the region. A language model doesn’t need a map at all, because a prompt can use $sourceName and $targetName, which is why the pre-built template has none. With mode set to endpoint, the codes in your engine’s answer are not converted automatically. Call $langIn in the response expression, as in this example for an engine that returns { "language": "PT-BR" } entries:
Codes that are not valid Phrase locales are ignored. The map counts toward the 8 KB size limit of the template.

Variables

These variables are available in request expressions: response, doneWhen, failedWhen, detail, okWhen and error expressions are evaluated against the engine’s response body and have no other variables. On top of the standard JSONata functions, these functions are available: $langOut and $langIn for language codes, and $fromJson(text), which parses JSON out of a text. $fromJson is meant for language models, which often wrap their answer in a markdown code block or add a sentence before it. If the text is not pure JSON, it uses the last JSON object it finds. Glossary. For each request, Phrase searches the term bases attached to the job and puts the entries that match the segments of that request into $glossary, without duplicates. If your engine supports glossaries, map them in the request. For a language model, list them in the prompt:

Metadata in a template

Metadata is a set of custom key/value pairs that you add to the engine. In the Phrase UI they are called Custom labels, and in the OpenAPI schema they are the metadata object. A template reads them from $meta, for example $meta.model. The placeholders from Dynamic metadata are resolved before the template runs. Values you enter as Custom labels are text, so convert them in the template when you need a number. A key that is not set has no value, so check it before you use it. The pre-built template reads these keys: Custom instructions. Set custom_instructions to add your own rules to every translation, such as tone of voice, terminology or style. The text is added to the prompt after the built-in translation rules. It applies to every request of the engine, so use a separate engine for rules that differ between projects. The placeholders from Dynamic metadata work here too, but they insert only an ID, not project-specific text. There is no fixed length limit. The text is sent with every request, so it counts against the context size and cost of your model, and you should keep it short.
Model. Set model to the name of any model your endpoint offers. Without it, the pre-built template uses gpt-4.1-mini. The template sends temperature 0 by default. It leaves it out for model names that contain claude, because those models reject it. A temperature you set always wins. Languages. Set languages to a comma-separated list of Phrase locale codes, such as en,de,fr, to limit the languages the engine offers. Phrase combines them into all pairs. Without it, the pre-built template offers its built-in list of languages. At most 100 codes are used, and unknown codes are ignored.

Pre-built template

The pre-built template connects to OpenAI and to other services that implement the OpenAI chat completions API. Set the Base engine URL to the base URL of the service, including its API version, for example https://api.openai.com/v1. The template:
  • calls POST /chat/completions with up to 50 segments per request, and checks health with GET /models. Both paths are added to the base engine URL;
  • asks the model to translate the segments, to keep inline tags and to return JSON, and adds your glossary and custom_instructions;
  • reads the translations from the first answer of the model, even when it is wrapped in a markdown code block;
  • reads the error message from the error object of the response;
  • sends a static anthropic-version header (2023-06-01). If your service doesn’t need it, remove the headers block from your copy of the template.
You can use the pre-built template as the starting point for your own: download it, change it, and upload it as a Custom template.

openai-compatible template

Download the template that Phrase uses for OpenAI-compatible engines.

Base engine URL by service

If you set up the pre-built template before November 5, 2026 with a base URL that has no API version, such as https://api.openai.com, add the version to the Base engine URL, for example https://api.openai.com/v1. Without it, calls to /chat/completions and /models fail with a 404 error.
The template paths don’t contain an API version, so the version belongs in the Base engine URL. It differs between services: These are the addresses the services document at the time of writing, so check your provider’s documentation if a call fails. A few services need more than the base URL:
  • Every service except OpenAI needs the model custom label set to one of its model names. Without it, the template uses gpt-4.1-mini, which only OpenAI offers.
  • Azure OpenAI expects the key in an api-key header. Set Header name to api-key and Header value to the key alone, without Bearer .
  • Some services, such as Perplexity, use paths other than /chat/completions or have no /models list. Check the API reference of your service. If the paths differ, use a Custom template with its own translate.path.
  • A service that doesn’t list models at /models fails the status check of the validation. Use a Custom template with a different status.path, or without a status block.

Troubleshooting

Next steps

Last updated: November 13, 2026. Track documentation changes in the changelog.