Overview
CLI Proxy API includes integrated support for Amp CLI and Amp IDE extensions, enabling you to use your existing Google/ChatGPT/Claude OAuth subscriptions with Amp’s coding tools.Key Features
- Provider route aliases for Amp’s API patterns (
/api/provider/{provider}/v1...) - Management proxy for OAuth authentication and account features
- Smart model fallback with automatic routing
- Model mapping to route unavailable models to alternatives (e.g.,
claude-opus-4.5→claude-sonnet-4) - Per-client upstream routing for multi-tenant deployments
- Security-first design with localhost-only management endpoints
Configuration
Basic Setup
Add theampcode section to your config.yaml:
config.yaml
Model Mappings
Route unavailable Amp models to alternative models available in your local proxy. This is useful when Amp CLI requests models you don’t have access to (e.g., Claude Opus 4.5) but you have a similar model available (e.g., Claude Sonnet 4).config.yaml
- Amp CLI requests a model (e.g.,
claude-opus-4-5-20251101) - If the model isn’t available locally, CLI Proxy API checks for a mapping
- If a mapping exists and the target model has providers, the request is routed to the target model
- If no mapping exists or the target model is unavailable, the request falls back to the Amp upstream
Per-Client Upstream Routing
For multi-tenant deployments, you can map different client API keys to different Amp upstream API keys:config.yaml
Management Proxy Routes
The following routes are proxied to the Amp upstream for OAuth authentication and account management:/api/auth/*- OAuth authentication flows/api/user/*- User profile and settings/api/internal/*- Internal Amp features/api/meta/*- Metadata endpoints/api/threads/*- Thread management/api/telemetry/*- Telemetry data/api/otel/*- OpenTelemetry integration/api/tab/*- Tab management/threads,/threads/*- Thread views (root-level)/docs,/docs/*- Documentation (root-level)/settings,/settings/*- Settings UI (root-level)/auth,/auth/*- Auth flows (root-level)
Security
Provider Routes
Amp CLI uses provider-specific routes. CLI Proxy API automatically translates these to your local providers:OpenAI/Codex
Anthropic/Claude
Google/Gemini
Example Setup
Authenticate with Amp
Use Amp CLI’s normal authentication flow. OAuth requests will be proxied through CLI Proxy API to
ampcode.com.Hot-Reload Support
The following configuration options support hot-reload without restarting the server:model-mappings- Update model routing rulesupstream-api-key- Change the default upstream API keyupstream-api-keys- Update per-client upstream key mappingsupstream-url- Change the upstream URLrestrict-management-to-localhost- Toggle localhost restriction
config.yaml and the changes will be applied automatically.
Troubleshooting
Model not found errors
If Amp requests a model that’s not available locally:- Check if you have the provider configured (OAuth or API key)
- Add a model mapping to route to an available alternative
- Ensure the target model in your mapping has available providers
OAuth authentication fails
If OAuth authentication doesn’t work:- Verify
upstream-urlis set correctly - Check that management routes are accessible (not blocked by firewall)
- If using
restrict-management-to-localhost: true, ensure you’re accessing from localhost
Fallback to upstream
If requests are falling back to the Amp upstream when you expect local routing:- Enable debug logging:
debug: trueinconfig.yaml - Check logs for “amp model mapping” messages
- Verify your model mappings are configured correctly
- Ensure the target model has available providers