Connect your application
Configure the model client once, then keep making normal model requests.
Base URL, credential, model
Set your compatible client’s base URL to the address supplied for your tlc setup. Use the caller credential for that address and the model identifier accepted by the configured provider. The base URL used in these examples includes /v1.
The gateway described here supports OpenAI-compatible chat completions. A Messages-format connection requires its corresponding adapter and configuration; confirm the supported format during setup.
A server-side JavaScript example
const baseURL = process.env.MODEL_BASE_URL.replace(//$/, "");
const response = await fetch(baseURL + "/chat/completions", {
method: "POST",
headers: {
"Authorization": "Bearer " + process.env.MODEL_API_KEY,
"Content-Type": "application/json"
},
body: JSON.stringify({
model: process.env.MODEL_NAME,
messages: [{ role: "user", content: "Explain this function." }]
})
});
if (!response.ok) {
throw new Error("Model request failed: " + response.status);
}
const answer = await response.json();
console.log(answer.choices[0].message.content);This example uses Node.js and reads configuration from the environment. Handle authentication, rate limits and provider errors before using the answer.
An existing model client
If your SDK supports a custom base URL, set that URL and its API key option. Keep your ordinary messages, model parameters and response handling. You do not need to call a separate model service from the middle of the request.
Check the connection
Start with one short prompt. Confirm an answer arrives and that your application handles both a normal response and an error. For streaming or tool use, test those request types before sending production traffic.
The Transductor is in early access. Join the waitlist.