Letta
Use Router9 as a custom provider in Letta
Letta (formerly MemGPT) is a framework for stateful agents with long-term memory. Its OpenAI provider accepts a custom base URL, so you can back Letta agents with Router9.
Setup
Point Letta's OpenAI provider at Router9 with two environment variables before starting the server:
export OPENAI_API_KEY=sk-r9k-your-key-here
export OPENAI_API_BASE=https://api.router9.com/v1Then start the Letta server as usual (for example letta server). Any agent configured with an OpenAI model will route through Router9.
Choosing Models
When creating an agent, set its LLM to an OpenAI-handle model that Router9 routes on:
from letta_client import Letta
client = Letta(base_url="http://localhost:8283")
agent = client.agents.create(
model="openai/anthropic/claude-opus-5",
# Router9 does not expose an embeddings endpoint — point embeddings at a
# provider that does (e.g. a local model or a separate embeddings key).
embedding="letta/letta-free",
)Swap openai/anthropic/claude-opus-5 for any chat model Router9 supports (see GET /v1/models), for example openai/deepseek/deepseek-v4-pro.
Embeddings: Router9 currently serves chat/tool models only — there is no
/v1/embeddingsendpoint. Configure Letta'sembeddinghandle with another provider (or Letta's built-inletta/letta-freeembeddings); only the chatmodelroutes through Router9.
MCP Setup
Letta supports MCP tool servers, so you can expose Router9's Skills
(image and audio tools) alongside the chat model. Register Router9's hosted MCP
server — URL https://api.router9.com/v1/mcp with an
Authorization: Bearer sk-r9k-your-key-here header — following Letta's MCP server
documentation. See Install MCP Server for the endpoint details.
Skills (optional): Router9 also offers image and audio Skills as agent tools. MCP is the recommended way to expose them where your harness supports it; otherwise call them directly as REST endpoints (
/v1/image/*,/v1/audio/*,/v1/search/) with yoursk-r9k-key — see the API Reference.
Tips
- Letta agents run long-lived, memory-heavy sessions — Router9's flat monthly pricing avoids per-token surprises.
- Set
OPENAI_API_BASEandOPENAI_API_KEYin the environment the Letta server runs in, not in agent code. - Router9 routes the chat
modelonly; keep theembeddinghandle on a provider that offers embeddings.