Skip to main content
TruGen lets you replace the default LLM with any OpenAI-compatible endpoint. Everything else (STT, TTS, avatar rendering, tools, knowledge base) keeps working. Use this for compliance, fine-tuned models, or your own inference infrastructure.

Why bring your own LLM

Requirements

Your endpoint must implement the OpenAI Chat Completions specification:
  • Endpoint: POST /chat/completions
  • Payload: accepts a messages: [] array
  • Streaming: Server-Sent Events (SSE) with data: framing
Optional: required only for specific features:
  • Function calling: needed if the agent uses tools
  • Vision: needed for multimodal inputs

Configure via the Developer Portal

1

Open your agent

Navigate to Create New Agent or an existing agent in app.trugen.ai.
2

Open Agent Config

Find the LLM section.
3

Select Bring Your Own LLM

In the Provider dropdown, select Bring your own LLM.
4

Enter your endpoint

Provide your API URL, Model Name, and API Token. Save.
Bring Your Own LLM configuration in Developer Studio

Developer Portal: Custom LLM configuration

Configure via API

Set the LLM config’s provider to "custom":
That’s the only change needed. The rest of your agent configuration is unchanged. Full request example:

Endpoint contract

Your /chat/completions handler receives:
And must respond with an SSE stream:

Keep-alive during long generations

Long generations without any output can trigger idle timeouts. Emit a comment line every 10 seconds:

Function calling

If your endpoint supports OpenAI-style function calling, return tool calls in the delta:
TruGen invokes the tool, sends the result back as a follow-up messages[].role: "tool" turn, and continues generation.

Fallback to a hosted model

If your custom endpoint errors or times out, TruGen can fall back to a hosted model automatically:
Strongly recommended for production: a single infrastructure hiccup on your side shouldn’t kill live sessions.

Latency expectations

Custom LLMs add network round-trip time between TruGen’s infrastructure and yours. Aim for:
  • Time to first token: under 500 ms
  • Endpoint region: as close to your TruGen region as possible
  • Network latency to TruGen edge: under 50 ms
If your endpoint is in a different continent, latency will noticeably degrade the conversation.

What’s next

Available LLMs

Compare hosted providers if BYO isn’t a hard requirement.

Prompting strategies

Write prompts that work well for real-time voice.

Tools

Enable function calling on your custom LLM.