Open models and fine-tuning
Open-weight models are now close to the closed frontier, cost a fraction of it per token, and can be fine-tuned on your own conversations. The router serves the strongest of them out of the box, and anything else you can reach over an OpenAI-compatible endpoint, a fine-tune included, plugs in as your own model.
Use an open model
Name it as provider/model wherever an agent takes a model:
llm: together/zai-org/GLM-5.3-FlashWhen several hosts serve the same weights, list them and the router fails over between them in that order:
llm:
providers:
- baseten/zai-org/GLM-5.3-Flash
- together/zai-org/GLM-5.3-FlashThinking is off by default for open models, because a voice agent cannot wait for it. See the LLM router for options and fallback, and Inference hardware and hosting for what each host is good for.
Top open models
The open-weight leaders on the Artificial Analysis Intelligence Index (v4.3.2, October 2026). Scores are measured with each model's maximum reasoning setting, so expect a little less with thinking off.
| Model | Index | Parameters (active) | Built-in target |
|---|---|---|---|
| MiMo-V2.6-Pro (Xiaomi) | 46 | 1.0T (42B) | Your own model |
| GLM-5.3 (Z AI) | 45 | 753B (40B) | baseten/zai-org/GLM-5.3, together/zai-org/GLM-5.3 |
| Kimi K3 (Kimi) | 44 | 2.8T (104B) | baseten/moonshotai/Kimi-K3, together/moonshotai/Kimi-K3 |
| GLM-5.3-Flash (Z AI) | 42 | 320B (18B) | baseten/zai-org/GLM-5.3-Flash, together/zai-org/GLM-5.3-Flash |
| Qwen3.8 Flash (Alibaba) | 40 | 125B (6B) | together/Qwen/Qwen3.8-Flash |
| DeepSeek V4.1 Flash | 39 | 552B (16B) | together/deepseek-ai/DeepSeek-V4.1-Flash |
| Qwen3.8 27B (Alibaba) | 34 | 27B (dense) | Your own model |
| K2 Horizon (IFM) | 31 | 375B (23B) | Your own model |
| MiniMax-M3 | 29 | 428B (23B) | together/MiniMaxAI/MiniMax-M3 |
| Inkling (Thinking Machines) | 25 | 975B (41B) | Your own model |
| Nemotron 3 Ultra (NVIDIA) | 23 | 550B (55B) | baseten/nvidia/NVIDIA-Nemotron-3-Ultra-550B-A55B |
The router also serves DeepSeek V4 Pro, Qwen3.8 2.4T and Gemma 4. Models marked "your own model" are served by hosts such as DeepInfra and Novita, or by your own GPUs; register the endpoint as below and they route like the rest.
Fine-tuning
Fine-tuning pays off when prompting has stopped helping: a fixed output format, a domain vocabulary, a tone, or a small model that has to behave like a large one on your task. Start from a strong small model (Qwen3.8 27B, Gemma 4, GLM-5.3-Flash) and a LoRA adapter, which trains in hours and serves next to the base model.
Your data is usually already here: sessions keep every turn, so the conversations that went well are your first training set.
Tutorials:
- Unsloth fine-tuning guide: LoRA and QLoRA on one GPU, the fastest way to a first adapter. Its RL guide covers GRPO
- Hugging Face TRL SFT trainer and LoRA Without Regret, on when LoRA matches full fine-tuning
- Axolotl: config-driven training for multi-GPU runs
- Tinker: a training API from Thinking Machines; you write the loop, they run the GPUs
- Managed fine-tuning, which also serves the result: Together (deploying it), Fireworks, Baseten Training and Nebius Token Factory
- Serving it yourself: vLLM's OpenAI-compatible server, with LoRA adapters, or SGLang
Whichever you pick, the result is an OpenAI-compatible endpoint, which is all the router needs.
Bring your own model
Register any OpenAI-compatible chat completions endpoint once, then name it as custom/<name>. Registering is server-side only. The cURL sample below is for Stream's hosted router; a self-hosted router in api_key mode takes X-Api-Key, Stream-Auth-Type: server and a server token instead, as in Run a local model:
Not documented for Python yet. Showing cURL.
Not documented for Ruby yet. Showing cURL.
Not documented for PHP yet. Showing cURL.
Not documented for .NET yet. Showing cURL.
Not documented for Rust yet. Showing cURL.
curl -sS -X POST "$STREAM_ACCELERATION_URL/v1/agents/models" \
-H "api_key: $STREAM_API_KEY" -H "stream-auth-type: jwt" \
-H "Authorization: Bearer $SERVER_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "support-qwen",
"base_url": "https://model-abc123.api.baseten.co/environments/production/sync/v1",
"model": "Qwen/Qwen3.8-27B",
"api_key": "'"$BASETEN_API_KEY"'",
"context_window": 262144,
"per_million_input_tokens": 0.2,
"per_million_output_tokens": 0.8,
"trains_on_data": "no",
"retention": "none"
}'import { Client } from "@stream-io/stream-agents";
const client = new Client();
await client.post("/v1/agents/models", {
body: {
name: "support-qwen",
base_url:
"https://model-abc123.api.baseten.co/environments/production/sync/v1",
model: "Qwen/Qwen3.8-27B",
api_key: process.env.BASETEN_API_KEY,
context_window: 262144,
per_million_input_tokens: 0.2,
per_million_output_tokens: 0.8,
trains_on_data: "no",
retention: "none",
},
});key := os.Getenv("BASETEN_API_KEY")
window := int64(262144)
_, err := client.DefineModel(ctx, acceleration.CustomModelRequest{
Name: "support-qwen",
BaseUrl: "https://model-abc123.api.baseten.co/environments/production/sync/v1",
Model: "Qwen/Qwen3.8-27B",
ApiKey: &key,
ContextWindow: &window,
})llm: custom/support-qwen| Field | Meaning |
|---|---|
name |
What you call it, unique in your Stream app. Lowercase letters, digits, ., _ and - |
base_url |
The endpoint root, up to and including /v1 |
model |
The id the endpoint serves the weights under |
api_key |
Sent as a bearer token. Sealed, never returned. Left out of an update keeps it; empty removes it. Without one, no Authorization header is sent |
context_window |
Tokens the endpoint runs the model with, so a long conversation is compacted before it overflows and the default reply cap fits beside the prompt |
input_modalities |
Inputs beyond text, such as image |
per_million_input_tokens, per_million_output_tokens |
What your host bills, in USD, so usage reports what a conversation cost |
trains_on_data, retention |
The host's data handling. Without both, a session with a data policy never routes here |
A custom model works everywhere a model does: in agent.yaml, a session's llm, a router's providers list (put a built-in model after it as the fallback), and a policy's allowed_models. Only your app can name its models. GET, PUT and DELETE /v1/agents/models/{id} read, replace and remove one. There are no per-model settings beyond the fields above: a session's max_tokens sets the reply cap.
The router shapes every request to a custom model for the chat template the weights ship with: one system message first, content on every tool-call turn, and tool-call ids of 9 characters. It gives the model 60 seconds to send its first token, sends a default max_tokens kept within context_window, and fails over when the endpoint answers 200 with something that isn't a stream. Two models showed limits of their own in testing: Ollama refuses tools for Gemma 3, whose chat template has no tool role, and a small Llama 3.2 on Ollama wrote a second tool call as JSON in its answer text instead of as a call. The details are in How the router talks to a model of your own.
A model on your own network
Stream's hosted router only calls public https endpoints. A model on your own hardware, such as Ollama, llama.cpp or vLLM on the next machine, is on a private address and usually plain http, so it needs a self-hosted router with private endpoints allowed:
models:
private_endpoints: true # or ROUTER_MODELS_PRIVATE_ENDPOINTS=trueWithout it, registering such an endpoint is refused with 400 base_url must be a public https URL without userinfo, query or fragment. Run a local model walks through it end to end.
Only turn this on for a router no one else's apps share, since it lets any app point the router at your network.
A model's api_key is sealed under the self-hosted router's key encryption key (ROUTER_DEV_KEK, or a Cloud KMS-wrapped key). A router with no key encryption key refuses a model with an api_key, with 400 not_configured; one without an api_key needs none.