-
-
Notifications
You must be signed in to change notification settings - Fork 69.8k
[Feature Request] Support for Custom Anthropic-Compatible API Endpoints #3162
Copy link
Copy link
Closed as not planned
Closed as not planned
Copy link
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
Request support for using custom Anthropic-compatible API endpoints (e.g., internal LLM gateways) instead of only the official Anthropic API.
Current Behavior
When configuring Moltbot with a custom baseUrl for the Anthropic provider, the application crashes with the following error:
Error: Unhandled API in mapOptionsForApi: undefined
at mapOptionsForApi (file:///usr/local/lib/node_modules/moltbot/node_modules/@mariozechner/pi-ai/src/stream.ts:471:10)
at streamSimple (file:///usr/local/lib/node_modules/moltbot/node_modules/@mariozechner/pi-ai/src/stream.ts:218:26)
Configuration Attempted
moltbot.json:
{
"agents": {
"defaults": {
"model": {
"primary": "anthropic/claude-sonnet-4.5"
}
}
},
"models": {
"providers": {
"anthropic": {
"baseUrl": "https://llm-gateway.example.com",
"apiKey": "sk-xxxxx",
"models": [...]
}
}
}
}Expected Behavior
Moltbot should support custom Anthropic-compatible API endpoints similar to Claude Code:
ANTHROPIC_BASE_URLenvironment variable support- Custom
baseUrlin provider configuration - Proper handling in
@mariozechner/pi-aipackage
Use Case
Internal LLM gateways for:
- Cost tracking
- Security and compliance
- Rate limiting
- Model routing
- Audit logging
Environment
- Moltbot Version: 2026.1.27-beta.1
- Node.js: v22.22.0
- OS: macOS Monterey
Proposed Solution
- Extend
@mariozechner/pi-aito support custom base URLs - Add proper API provider detection in
mapOptionsForApi - Allow
baseUrlto pass through to API client
Additional Context
- Claude Code successfully supports this via
ANTHROPIC_BASE_URL - Error originates from
@mariozechner/pi-aidependency - Would benefit enterprise users with internal infrastructure
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Type
Fields
Give feedbackNo fields configured for issues without a type.