GET /v1/models
Retrieve a list of all available models from your configured authentication providers. The response aggregates models from all active providers (Gemini, Claude, Codex, etc.) and formats them in OpenAI-compatible format.Authentication
This endpoint requires authentication via theAuthorization header:
Response Format
Always
list.Model Aggregation
The models list is dynamically generated based on:- Active Authentication Providers: Only models from authenticated providers are included
- Model Registry: The global model registry (
internal/registry) tracks available models per provider - Filtered Response: The API returns only the essential fields (
id,object,created,owned_by) to match OpenAI’s format
Provider-Specific Models
Models are sourced from multiple providers:- Gemini:
gemini-2.5-pro,gemini-2.5-flash,gemini-exp-1206, etc. - Claude:
claude-sonnet-4,claude-opus-4,claude-haiku-4, etc. - Codex: OpenAI Codex models via OAuth
- Vertex AI: Gemini models via service accounts or API keys
- OpenAI-Compatible: Custom endpoints configured in
openai_compatibility - Other Providers: Qwen, Antigravity, iFlow, Kimi
Examples
List All Models
With Python OpenAI SDK
With JavaScript/TypeScript
Implementation Details
The/v1/models endpoint is implemented in sdk/api/handlers/openai/openai_handlers.go:
- Dynamic Registry: Models are fetched from the global model registry which tracks available models per authenticated provider
- Filtered Fields: Only returns the 4 required OpenAI fields to maintain API compatibility
- User-Agent Routing: If the User-Agent starts with
claude-cli, the request is routed to the Claude-specific models handler instead
Source Code Reference
Fromopenai_handlers.go:58-90:
Model Aliasing
You can create custom model aliases using theampcode.model-mappings configuration:
/v1/models list and can be used in requests.
The model list updates dynamically as authentication providers are added or removed. Changes to authentication files in the auth directory are detected automatically.
Error Responses
Errors follow the OpenAI error format:401 Unauthorized: Missing or invalid API key500 Internal Server Error: Server-side error retrieving models