-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Description
Letta v0.11.7 has a critical bug when parsing model IDs for OpenRouter models. When using models with the handle format openai-proxy/vendor/model
, Letta incorrectly extracts only the vendor name instead of the full vendor/model
ID, causing all OpenRouter models to fail with 400 Bad Request errors.
Steps to Reproduce
-
Start Letta v0.11.7 with Docker using OpenRouter configuration:
docker run \ -v "C:\Letta\LettaAgentData:/var/lib/postgresql/data" \ -p 8283:8283 \ -e OPENAI_API_BASE="https://openrouter.ai/api/v1" \ -e OPENAI_API_KEY="sk-or-v1-..." \ letta/letta:latest
-
In the Web UI, select any OpenRouter model (e.g.,
openai-proxy/x-ai/grok-4-fast
) -
Create an agent and send a message
Expected Behavior
Letta should send the complete model ID (e.g., x-ai/grok-4-fast
) to OpenRouter's API.
Actual Behavior
Letta incorrectly parses the model ID from the handle format and sends only the vendor name (e.g., x-ai
), resulting in:
HTTP Request: POST https://openrouter.ai/api/v1/chat/completions "HTTP/1.1 400 Bad Request"
WARNING - [OpenAI] Bad request (400): Error code: 400 - {'error': {'message': 'x-ai is not a valid model ID', 'code': 400}}
Impact
All OpenRouter models are affected, including:
openai-proxy/x-ai/grok-4-fast
→ sendsx-ai
openai-proxy/anthropic/claude-3.5-sonnet
→ sendsanthropic
openai-proxy/qwen/qwen3-235b-a22b
→ sendsqwen
The built-in letta/letta-free
model works correctly, suggesting this is specific to OpenRouter model parsing.
Environment
- Letta Version: v0.11.7
- Docker Image: letta/letta:latest
- OS: Windows 10
- OpenRouter API Base: https://openrouter.ai/api/v1
Technical Analysis
Model Data Structure
Each model in Letta's /v1/models
endpoint has this structure:
{
"model": "x-ai/grok-4-fast", // Correct model ID
"handle": "openai-proxy/x-ai/grok-4-fast", // Web UI display name
"model_endpoint": "https://openrouter.ai/api/v1"
}
Bug Location
Letta should use the model
field (x-ai/grok-4-fast
) when making API calls, but incorrectly parses the handle
field and extracts only the vendor portion (x-ai
).
Handle format: openai-proxy / x-ai / grok-4-fast
^^^^^^
Bug: extracts only this part
Should send: x-ai/grok-4-fast (from model field)
Actually sends: x-ai (incorrectly parsed from handle)
Workaround
Until fixed, users can switch to the built-in letta/letta-free
model or other non-OpenRouter models.
Additional Context
This appears to be a regression in model ID parsing logic introduced in v0.11.7. The issue affects all OpenRouter models uniformly, suggesting a systematic problem in the model selection/parsing pipeline.