v0.8.0 · 24+ providers · chat, embeddings, TTS, STT, realtime, rerank · new router package

One Go client.
Every model. Every platform.

llmrouter is a streaming-first Go library that gives you an OpenAI-shaped API across 24+ providers — chat, embeddings, text-to-speech, speech-to-text, full-duplex realtime, structured outputs, and rerank — plus a new router package that decouples the model vendor from the hosting platform (Claude on Bedrock, Llama on Groq, GPT on Azure) with one call.

$ go get github.com/elloloop/llmrouter@v0.8.0
Go 1.23+ · Apache-2.0 · stdlib + google/uuid only

Four properties. That’s the whole pitch.

Most multi-LLM libraries reach for breadth. llmrouter is narrower and more opinionated — designed around the shape of code that has to ship to production.

S

Streaming-first

Channel-based deltas with a producer goroutine and proper context.Context cancellation that propagates all the way to the in-flight HTTP request. Cancel the context and the upstream connection closes — no leaked goroutines, no orphaned token spend.

B

Byte passthrough

Every chunk preserves its original wire bytes via Chunk.Raw. Build proxies and gateways that are byte-identical to upstream OpenAI without re-marshalling typed structs — the bytes you forward downstream are the bytes you received.

M×P

Model × Platform router

v0.8 ships the router package: router.Resolve(Request{Model, Platform, Credentials}) turns “Claude on Bedrock” or “Llama on Groq” into a working Provider. Twelve platforms, nine model families, one resolver. Application code never branches on which provider package handles which combination.

A+R

Audio, embeddings, realtime, rerank

Chat is not the whole story. v0.3 added Speaker, Transcriber, and Embedder. v0.4 added WebSocket streaming and full-duplex openairealtime.Session. v0.5 added Gemini Live, tool use on Realtime, structured outputs, and a Reranker interface (Cohere, Voyage, Together). v0.6 added voice-agent-friendly SpeechFinal on STT.

D

Boring dependencies

The only dependencies are the Go standard library, google/uuid, and the official vendor SDKs for the cloud providers (AWS, Google, Anthropic). No surprise transitive trees.

llmrouter is the library a gateway is built on top of — not the gateway itself.

24+ providers, six capabilities, one shape.

v0.8 ships chat, embeddings, TTS, STT, full-duplex realtime, and rerank — against every major LLM vendor plus specialist audio, embedding, realtime, and rerank shops. Structured outputs (JSON Schema) work cross-vendor on the chat surface. A new router package picks the right provider from the model id + available credentials.

CHAT

18 chat providers

OpenAI, Anthropic, Azure OpenAI, Azure Foundry Anthropic, Azure Foundry Serverless (Llama / Mistral / Cohere / Phi / DeepSeek), Bedrock, Vertex, Vertex Anthropic, Gemini, Cohere, Mistral — plus OpenRouter, Together, Groq, DeepSeek, Fireworks, xAI, Perplexity, Cerebras via the OpenAI-compatible path.

M×P

The router (new in v0.8)

router.Resolve(Request{Model, Platform, Credentials}) returns a working Provider. 12 platforms × 9 model families. Pass PlatformAuto and the router picks the first platform with credentials present. See The Router.

EMB

11 embedding providers

OpenAI, Azure, Bedrock (Titan + Cohere), Vertex, Gemini, Cohere, Mistral, Together, Fireworks, DeepSeek, and Voyage AI — the canonical pairing for Anthropic Claude.

TTS

5 text-to-speech providers

OpenAI tts-1 / tts-1-hd, Azure, Gemini, ElevenLabs for highest quality, and Cartesia Sonic-2 for sub-100 ms latency real-time agents.

STT

5 speech-to-text providers

OpenAI Whisper, Azure Whisper, Groq Whisper, Gemini audio understanding, ElevenLabs Scribe, and Deepgram Nova-3 — now with WebSocket live transcription on Deepgram (v0.4).

RT

Realtime voice agents

OpenAI Realtime (now with typed tool use) and Gemini Live for full-duplex audio + text, plus SpeakRealtime on Cartesia and ElevenLabs for multi-turn TTS. See Realtime sessions.

JSON

Structured outputs

One ChatRequest.ResponseSchema field, three wire translations: native response_format on OpenAI, forced tool-use on Anthropic, ResponseMIMEType on Vertex / Gemini. See Structured outputs.

RNK

Rerank for RAG

One Reranker interface across Cohere (rerank-v3.5), Voyage (rerank-2), and Together (Llama-Rank-V1). Second-stage filter for any RAG pipeline. See Rerank.

URL

Any OpenAI-compatible endpoint

One WithBaseURL call points the OpenAI provider at OpenRouter, Together, Groq, vLLM, Ollama, LM Studio, or your private model behind a firewall. No new SDK per vendor.

A2

Apache-2.0, pre-1.0

Apache-2.0 licensed. Currently v0.8.x — expect minor API churn between minor versions until v1.0 freezes the surface. Patch versions never break the API.

From go get to streaming tokens in 40 lines.

Open a streaming chat completion, print each delta as it arrives, exit on a clean close. The same code runs against any OpenAI-compatible endpoint.

package main
import (
"context"
"fmt"
"log"
"os"
"github.com/elloloop/llmrouter"
"github.com/elloloop/llmrouter/providers/openai"
)
func main() {
p, err := openai.New(llmrouter.WithAPIKey(os.Getenv("OPENAI_API_KEY")))
if err != nil {
log.Fatal(err)
}
stream, err := p.CompletionStream(context.Background(), llmrouter.ChatRequest{
Model: "gpt-4o-mini",
Messages: []llmrouter.Message{
llmrouter.TextMessage("user", "Say hi in 5 words."),
},
})
if err != nil {
log.Fatal(err)
}
for chunk := range stream.Chunks() {
for _, c := range chunk.Choices {
fmt.Print(c.Delta.Content)
}
}
if err := stream.Err(); err != nil {
log.Fatal(err)
}
}

Want Anthropic instead? Swap the import and the model id — the loop, the request shape, and the consumer don’t change.

// Same program, with one import and one model id changed.
import "github.com/elloloop/llmrouter/providers/anthropic"
p, _ := anthropic.New(llmrouter.WithAPIKey(os.Getenv("ANTHROPIC_API_KEY")))
stream, _ := p.CompletionStream(ctx, llmrouter.ChatRequest{
Model: "claude-3-5-sonnet-latest",
Messages: []llmrouter.Message{
llmrouter.TextMessage("system", "You are concise."),
llmrouter.TextMessage("user", "Why is the sky blue?"),
},
MaxTokens: 256,
})

Six capabilities. 24+ backends. One router.

Chat, embeddings, TTS, STT, and rerank are single one-method interfaces. Realtime is its own session-based surface for full-duplex voice agents. Structured outputs ride on the chat surface as one extra field. The new router package decouples the model vendor from the hosting platform — application code never branches on which provider package is upstream.

Provider Chat Embeddings TTS STT Rerank Structured outputs
OpenAIWhisper
Anthropicuse Voyagetool-use
Azure OpenAIWhisper
Azure Foundry — Anthropictool-use
Azure Foundry — Serverless
AWS BedrockTitan + Cohere
Vertex AIpartial
Vertex AI — Anthropictool-use
Gemini (AI Studio)audio
Coherev3.5
Mistral
TogetherdelegatedLlama-Rank
GroqWhisper
OpenRouter
Fireworks
DeepSeek
xAI (Grok)
Perplexity
Cerebras
ElevenLabsScribe
DeepgramNova-3
CartesiaSonic-2
Voyage AIrerank-2
OpenAI Realtimesessionsessionsession
Gemini Livesessionsessionsession
Router

Model × Platform router (v0.8)

router.Resolve(Request{Model, Platform, Credentials}) returns a working Provider. 12 platforms, 9 model families. PlatformAuto picks from env vars. This is the headline value prop.

Read The Router →
Chat

18 chat providers

OpenAI, Anthropic, Azure OpenAI, Azure Foundry Anthropic, Azure Foundry Serverless, Bedrock, Vertex, Vertex Anthropic, Gemini, Cohere, Mistral — plus eight OpenAI-compatible vendors via WithBaseURL.

Browse chat providers →
Audio

TTS & STT

TTS: ElevenLabs · Cartesia · OpenAI · Azure · Gemini.
STT: Deepgram · ElevenLabs Scribe · OpenAI / Azure / Groq Whisper · Gemini.

Read Audio concept →
Embeddings

11 embedding providers

OpenAI · Azure · Cohere · Voyage · Vertex · Gemini · Mistral · Together · Fireworks · DeepSeek · Bedrock (Titan + Cohere).

Read Embeddings concept →
Realtime

Realtime & WebSocket

OpenAI Realtime (with typed tool use, v0.5) and Gemini Live full-duplex sessions. Deepgram WebSocket live transcription. SpeakRealtime on Cartesia and ElevenLabs.

Read Realtime concept →
Rerank

3 rerank providers

Cohere (rerank-v3.5) · Voyage (rerank-2) · Together (Llama-Rank-V1). Second-stage filter for any RAG pipeline. New in v0.5.

Read Rerank concept →
Structured

Structured outputs

Cross-vendor ChatRequest.ResponseSchema field. Native on OpenAI; forced tool-use on Anthropic; ResponseMIMEType on Vertex and Gemini. New in v0.5.

Read Structured outputs →
v0.8.0
Latest release
24+
Provider packages
6
Capabilities (chat, embed, TTS, STT, realtime, rerank)
~2,600
Subtests

Install in one line.

Go 1.23+. Apache-2.0. No surprises in your go.sum.

$ go get github.com/elloloop/llmrouter@v0.8.0

Then head to the quick-start guide for the canonical OpenAI & Anthropic walkthroughs, or read the comparison vs alternatives if you’re still evaluating.