Skip to main content
The Context Router sits in front of the LLM step. Every turn goes through it first, and it decides how to answer: from cache, a small in-region model, a prepared response, or a full model call, with fallbacks when a model is slow or fails. It speaks the OpenAI API format, so any agent framework or voice platform with a custom LLM field can point at it. Call the API directly or configure it as the custom large language model in a supported agent integration. See the Context Router API reference for request and response fields.

Prerequisites

  • An SLNG API key. See Create your API key.
  • A model for the router to answer with. Give it one of two ways:
    • Register a BYOK LLM key in the dashboard. The router then routes slng/auto to that model with nothing extra in the request. Use this for a voice platform integration, which only lets you set a base URL, an API key and a model. See Bring your own key.
    • Send your configuration inline in the slng_config body field when you call the API from your own code. Nothing to register in advance, and a request that carries it ignores any registered configuration. See BYOK Context Router.

Configuration

Point your integration’s custom LLM at these values: The Custom LLM guide covers the OpenAI-compatible setup. Each platform guide has the exact steps for its dashboard or SDK: ElevenLabs, Vapi, Deepgram, LiveKit, and Pipecat.

Agent and session headers

The router requires two headers on every request so it can tie each turn to the right agent and call: Map them to your platform’s own agent and session values. In ElevenLabs they are the system__agent_id and system__conversation_id variables; in Vapi they are {{assistant.id}} and {{call.id}}; in code you pass a stable agent ID and the current session ID. Your platform guide lists the exact values. Values are at most 256 characters and cannot contain spaces, commas, pipes (|) or braces ({ }). An opaque ID or slug is always safe. A request missing either header, or carrying a malformed one, returns a 400 with code missing_client_id or invalid_client_id. When you call the API from your own code, send them as the body fields slng_agent_id and slng_session_id instead.
The agent ID also scopes the response cache, so answers cached for one agent ID are never served to another. When you change an agent’s prompt in a meaningful way, give it a fresh agent ID, for example by adding a version suffix. Otherwise answers produced under the old prompt stay in scope for the new one.