Skip to main content

Overview

The models endpoint returns a list of available AI models accessible through your Codex-LB instance. Each model includes metadata about capabilities, reasoning support, and configuration options.

Endpoint

GET /backend-api/codex/models

Retrieves the list of available models. Base URL: https://your-codex-lb-instance.com

Query Parameters

None.

Response

object
string
Always returns "list"
data
array
Array of model objects

Example Response

{
  "object": "list",
  "data": [
    {
      "id": "gpt-5.1",
      "object": "model",
      "created": 1704067200,
      "owned_by": "codex-lb",
      "metadata": {
        "display_name": "GPT-5.1",
        "description": "Advanced reasoning model with extended context",
        "context_window": 128000,
        "input_modalities": ["text", "image"],
        "supported_reasoning_levels": [
          {
            "effort": "low",
            "description": "Fast responses with minimal reasoning"
          },
          {
            "effort": "medium",
            "description": "Balanced reasoning and speed"
          },
          {
            "effort": "high",
            "description": "Maximum reasoning depth and accuracy"
          }
        ],
        "default_reasoning_level": "medium",
        "supports_reasoning_summaries": true,
        "support_verbosity": true,
        "default_verbosity": "standard",
        "prefer_websockets": false,
        "supports_parallel_tool_calls": true,
        "supported_in_api": true,
        "minimal_client_version": null,
        "priority": 100
      }
    },
    {
      "id": "gpt-4o",
      "object": "model",
      "created": 1704067200,
      "owned_by": "codex-lb",
      "metadata": {
        "display_name": "GPT-4o",
        "description": "Fast and efficient multimodal model",
        "context_window": 128000,
        "input_modalities": ["text", "image", "audio"],
        "supported_reasoning_levels": [],
        "default_reasoning_level": null,
        "supports_reasoning_summaries": false,
        "support_verbosity": false,
        "default_verbosity": null,
        "prefer_websockets": false,
        "supports_parallel_tool_calls": true,
        "supported_in_api": true,
        "minimal_client_version": null,
        "priority": 90
      }
    }
  ]
}

Example Request

curl -X GET https://your-codex-lb-instance.com/backend-api/codex/models \
  -H "Authorization: Bearer YOUR_API_KEY"

Authentication

This endpoint requires authentication using an API key. Include your API key in the Authorization header:
Authorization: Bearer YOUR_API_KEY

API Key Model Filtering

If your API key has restricted access to specific models (configured via the allowed_models field), the response will only include models that your key is authorized to use.

Rate Limiting

This endpoint counts against your API key’s rate limit, even though it doesn’t make requests to upstream AI providers. This is to enforce fair usage of the Codex-LB infrastructure.

Use Cases

Selecting Models by Capability

import requests

def get_models_with_reasoning(api_key):
    response = requests.get(
        "https://your-codex-lb-instance.com/backend-api/codex/models",
        headers={"Authorization": f"Bearer {api_key}"}
    )
    models = response.json()["data"]
    
    return [
        model["id"] 
        for model in models 
        if model["metadata"]["supported_reasoning_levels"]
    ]

reasoning_models = get_models_with_reasoning("your-api-key")
print(f"Models with reasoning: {reasoning_models}")

Finding Models by Context Window

def get_models_by_context(api_key, min_context=100000):
    response = requests.get(
        "https://your-codex-lb-instance.com/backend-api/codex/models",
        headers={"Authorization": f"Bearer {api_key}"}
    )
    models = response.json()["data"]
    
    return [
        {
            "id": model["id"],
            "name": model["metadata"]["display_name"],
            "context": model["metadata"]["context_window"]
        }
        for model in models
        if model["metadata"]["context_window"] >= min_context
    ]

large_context_models = get_models_by_context("your-api-key", min_context=128000)
for model in large_context_models:
    print(f"{model['name']}: {model['context']:,} tokens")

Notes

  • Model availability depends on the accounts configured in your Codex-LB instance
  • The priority field affects load balancing decisions when multiple models are suitable
  • Models with supported_in_api: false are not available via API endpoints
  • The prefer_websockets flag indicates the recommended connection type for optimal performance
  • Model metadata is cached and refreshed periodically based on your configuration

Build docs developers (and LLMs) love