| title | Models |
|---|---|
| openapi | get /models |
The GET /v1/models endpoint behaves differently depending on whether your request carries provider routing signals (headers or config). Understanding this is important when you're deciding which model list your application should consume.
Portkey inspects your request for any of the following provider signals:
x-portkey-providerheaderx-portkey-virtual-keyheaderx-portkey-configwithprovider,virtual_key, ortargetsset
| Provider signal present? | fetch_integrated_models set? |
Response |
|---|---|---|
| No | — | Portkey integrated models (model catalog) |
| Yes | No | Provider-backed — proxied to the provider's /v1/models |
| Yes | Yes | Portkey integrated models, filtered to the providers referenced in your config |
When you send a provider signal (e.g. x-portkey-provider: @openai-prod), Portkey calls that provider's /v1/models endpoint and returns the response.
By default, Portkey normalizes the provider's response into the standard OpenAI models list format — the same shape as openai.com/v1/models:
{
"object": "list",
"data": [
{
"id": "claude-3-5-sonnet-20241022",
"object": "model",
"created": 1729555200,
"owned_by": "anthropic"
}
],
"provider": "anthropic"
}To receive the raw provider response without normalization, set strict_open_ai_compliance to false. See Strict OpenAI Compliance for details.
curl https://api.portkey.ai/v1/models \
-H "x-portkey-api-key: $PORTKEY_API_KEY" \
-H "x-portkey-provider: @anthropic-prod" \
-H "x-portkey-strict-open-ai-compliance: false"from portkey_ai import Portkey
portkey = Portkey(
api_key="PORTKEY_API_KEY",
provider="@anthropic-prod",
strict_open_ai_compliance=False
)
models = portkey.models.list()import Portkey from 'portkey-ai';
const portkey = new Portkey({
apiKey: 'PORTKEY_API_KEY',
provider: '@anthropic-prod',
strictOpenAiCompliance: false
});
const models = await portkey.models.list();Native listModels support (with OpenAI-format normalization) is available for:
- OpenAI
- Azure OpenAI
- Anthropic
- Google (Gemini)
- Google Vertex AI
- AWS Bedrock
For providers without a native listModels transform, the raw provider response is returned as-is.
Even when a provider signal is present, you can force Portkey to return your integrated (model catalog) models — the ones set up in your workspace — by using one of the following:
Header. Set to `true` to return integrated models even when a provider/virtual-key/config is passed on the request. Config field. Set to `true` on your Portkey config to achieve the same effect.When active, Portkey filters the integrated model list to only the provider slugs referenced in your routing config (including virtual keys and @provider/model overrides). If any leaf in the config uses passthrough: true, all integrated models are returned unfiltered.
curl https://api.portkey.ai/v1/models \
-H "x-portkey-api-key: $PORTKEY_API_KEY" \
-H "x-portkey-provider: @openai-prod" \
-H "x-portkey-fetch-integrated-models: true"{
"fetch_integrated_models": true,
"targets": [
{ "virtual_key": "openai-prod" },
{ "virtual_key": "anthropic-prod" }
]
}| If you want to… | Use |
|---|---|
| Show the full list of models the provider currently offers | Provider-backed (default with a provider signal) |
| Show only the models available in your Portkey workspace | Send no provider signal, or set x-portkey-fetch-integrated-models: true |
| Get the untouched provider payload (extra fields, provider-specific metadata) | Provider-backed + strict_open_ai_compliance: false |