- Which layers run on SLNG. Speech to text (STT), the large language model (LLM), text to speech (TTS), or none of them, with the execution layer in front of every call.
- The region. The project’s API key works in that region only.
- The API key. Only a key created inside this project can call the Context Router.
Pick the right API key
SLNG has three kinds of API key. They are not interchangeable, so check which one you have before you write code.403 project_mode_forbidden. To use the router, create the key in
an Improve my agent project, as below.
Create the project
Choose your framework

Choose your framework under In your own code.
Choose what runs on SLNG

The four configurations. Voice in, voice out runs speech on SLNG and keeps your LLM.
Name the project and pick its region

Pick the region your callers are closest to.
Use the key in its region
A project’s API keys live in the project’s region and work only there. Your code names the region in two base URLs, and both must use the region’s gateway code:eu-north, and for the United Kingdom it
is gb. A request to another region’s router answers 401. If you move the
project to another region in its settings, change the code in both URLs too.
Set up Listen and Speak
Open Execution Layer > Listen to choose the speech to text model, and Speak to choose the text to speech model and voice. Each model dropdown has an SLNG models tab and a BYOK tab for a model on your own provider key. The Integrate prompt writes these choices into your code, and your code sends the model ID with each request. For the dropdowns and toggles, see Listen and Speak.Set up the LLM
The Context Router answers with a model from one of three places. Pick one:"model": "slng/auto". Without slng_config, the router answers with
the Think model. With slng_config, it picks from the models the config names,
so you write the model name in one place only.
In every other configuration the LLM is yours, so the router refuses an SLNG model
with 403 project_mode_forbidden and asks for your own credentials.
You can also skip the router and call your LLM directly, as speech.py does:
your speech still runs on SLNG, but the LLM step gets no caching, routing, or
failover.
Save your model in the dashboard
Open Think

The BYOK tab lists your saved models. Add new key registers another.
Add your provider key
gpt-4o, your provider’s API key, and its
Endpoint URL, such as https://api.openai.com/v1. Leave Provider on
Auto-detect, or pick one. Click Add key.
Add an LLM provider: model, API key, endpoint URL, and an optional provider.
Choose it and save
"model": "slng/auto" now answer with it.Send your model with each request
To keep the model and its key in your code instead, send them in theslng_config body field. The router answers that request with them, whatever
Think holds, and the project’s other settings still apply:
"model": "slng/auto": the router picks gpt-5.6-luna from the
config, so the model name is written once. The api_key inside endpoint is your
provider key. Your SLNG key stays in the Authorization header. kwargs holds
request settings for this model, here a voice-friendly reasoning_effort. For every field, other providers, and two-tier routing,
see BYOK Context Router.
Create the project API key
Open the project's API keys
Name the key
wayne-enterprises-prod. The Project field
shows this project and the layers the key can call, for example Execution
Layer stt tts. Set an Expiration date, or leave it empty.
A key created here belongs to this project and its region.
Generate and copy the key
SLNG_API_KEY, as in
Store and use your key.Send an agent ID and a session ID
Every request your agent makes carries two IDs: one for the agent, one for the call. Send the same two values to speech to text, the LLM, and text to speech, so SLNG ties each call’s usage, cache, and logs together.- Agent ID names the agent. Use one stable value, such as
wayne-concierge-v1. It also scopes the Context Router cache, so give the agent a new ID, such aswayne-concierge-v2, when you change its prompt in a meaningful way. - Session ID names one call. Use a value unique to the call, like a UUID or your room or call ID, and keep it the same on every turn of that call.
400 missing_client_id without them. For
the value rules, see
Agent and session headers.
Fill per-call values with template variables
Write values that change per call, such as the caller’s name, as{{name}}
placeholders in your prompt. Send their values with each request in
template_variables, and the Context Router fills them in before the model sees
the prompt:
422 missing_template_variables. The LiveKit and
Pipecat guides show where each framework sends them,
and Per-call values
covers the syntax and limits.
Check your setup
The SLNG templates cover each LLM option for both frameworks. Each template’ssmoke.py runs one spoken turn,
caller audio to transcript to reply to audio, with no microphone: