Models

List, search, and compare available AI models via the Models API.

Overview

The Models API lets you discover all 100+ models available through AllRoutes, including pricing, capabilities, and provider information.

List All Models

GET https://api.allroutes.ai/v1/models

Returns all models available on the gateway.

Query Parameters

ParameterTypeDescription
providerstringFilter by provider name (e.g., openai, anthropic, google)
categorystringFilter by category (e.g., chat, embedding, image, code)
capabilitystringFilter by capability (e.g., streaming, function_calling, vision, json_mode)
activebooleanFilter by active status (default: true)

Example

curl https://api.allroutes.ai/v1/models?provider=openai \
  -H "Authorization: Bearer allroutes_sk_..."

Response

{
  "object": "list",
  "data": [
    {
      "id": "gpt-4o",
      "object": "model",
      "name": "GPT-4o",
      "provider": "openai",
      "context_length": 128000,
      "input_cost_per_token": 0.0000025,
      "output_cost_per_token": 0.00001,
      "is_active": true,
      "capabilities": ["streaming", "function_calling", "vision", "json_mode"],
      "category": "chat",
      "created": 1714000000
    }
  ]
}

Model Fields

FieldTypeDescription
idstringModel identifier used in API requests
namestringHuman-readable display name
providerstringProvider name
context_lengthintegerMaximum context window in tokens
input_cost_per_tokenfloatCost per input token in USD
output_cost_per_tokenfloatCost per output token in USD
is_activebooleanWhether the model is currently available
capabilitiesarraySupported features
categorystringModel category

Get Model Details

GET https://api.allroutes.ai/v1/models/:id

Returns detailed information for a specific model.

curl https://api.allroutes.ai/v1/models/gpt-4o \
  -H "Authorization: Bearer allroutes_sk_..."

Response

{
  "id": "gpt-4o",
  "object": "model",
  "name": "GPT-4o",
  "provider": "openai",
  "context_length": 128000,
  "input_cost_per_token": 0.0000025,
  "output_cost_per_token": 0.00001,
  "is_active": true,
  "capabilities": ["streaming", "function_calling", "vision", "json_mode"],
  "category": "chat",
  "max_output_tokens": 16384,
  "supports_streaming": true,
  "supports_function_calling": true,
  "supports_vision": true,
  "supports_json_mode": true,
  "created": 1714000000
}

Search Models

GET https://api.allroutes.ai/v1/models/search

Full-text search across model names, descriptions, and providers.

ParameterTypeDescription
qstringSearch query (e.g., "fast coding", "vision")
providerstringNarrow results to a specific provider
limitintegerMax results (default: 20, max: 100)
curl "https://api.allroutes.ai/v1/models/search?q=vision&provider=openai" \
  -H "Authorization: Bearer allroutes_sk_..."

Compare Models

GET https://api.allroutes.ai/v1/models/compare

Compare pricing, capabilities, and context lengths for multiple models side by side.

ParameterTypeDescription
modelsstringComma-separated model IDs to compare
curl "https://api.allroutes.ai/v1/models/compare?models=gpt-4o,claude-sonnet-4-20250514,gemini-2.0-flash" \
  -H "Authorization: Bearer allroutes_sk_..."

Response

{
  "models": [
    {
      "id": "gpt-4o",
      "provider": "openai",
      "context_length": 128000,
      "input_cost_per_token": 0.0000025,
      "output_cost_per_token": 0.00001,
      "capabilities": ["streaming", "function_calling", "vision", "json_mode"]
    },
    {
      "id": "claude-sonnet-4-20250514",
      "provider": "anthropic",
      "context_length": 200000,
      "input_cost_per_token": 0.000003,
      "output_cost_per_token": 0.000015,
      "capabilities": ["streaming", "function_calling", "vision", "json_mode"]
    },
    {
      "id": "gemini-2.0-flash",
      "provider": "google",
      "context_length": 1048576,
      "input_cost_per_token": 0.00000015,
      "output_cost_per_token": 0.0000006,
      "capabilities": ["streaming", "function_calling", "vision", "json_mode"]
    }
  ]
}

SDK Examples

Python

models = client.list_models()
for model in models:
    print(f"{model['id']} by {model['provider']}")

Node.js

const models = await client.listAllRoutesModels();
for (const model of models) {
  console.log(`${model.name} by ${model.provider} - ctx: ${model.context_length}`);
}

Go

models, err := client.ListModels(ctx)
if err != nil {
    log.Fatal(err)
}
for _, m := range models {
    fmt.Printf("%s (%s) by %s -- ctx: %d\n",
        m.DisplayName, m.ID, m.ProviderName, m.ContextWindow)
}

See Also

  • Chat Completions -- send completions to any listed model
  • Embeddings -- list embedding models specifically
  • Model Groups -- alias multiple models behind one identifier
  • Free Tier -- which models are available at no cost
  • BYOK -- restrict the catalog to your own provider keys