> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/Soju06/codex-lb/llms.txt
> Use this file to discover all available pages before exploring further.

# Codex Models

> List available AI models through the Codex-LB proxy

## 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

<ResponseField name="object" type="string">
  Always returns `"list"`
</ResponseField>

<ResponseField name="data" type="array">
  Array of model objects

  <Expandable title="Model Object Properties">
    <ResponseField name="id" type="string">
      Model identifier (e.g., `gpt-5.1`, `gpt-4o`)
    </ResponseField>

    <ResponseField name="object" type="string">
      Always `"model"`
    </ResponseField>

    <ResponseField name="created" type="integer">
      Unix timestamp of when the model was registered
    </ResponseField>

    <ResponseField name="owned_by" type="string">
      Always `"codex-lb"`
    </ResponseField>

    <ResponseField name="metadata" type="object">
      Model metadata and capabilities

      <Expandable title="Metadata Properties">
        <ResponseField name="display_name" type="string">
          Human-readable model name
        </ResponseField>

        <ResponseField name="description" type="string">
          Model description
        </ResponseField>

        <ResponseField name="context_window" type="integer">
          Maximum context window size in tokens
        </ResponseField>

        <ResponseField name="input_modalities" type="array">
          Supported input types (e.g., `["text", "image", "audio"]`)
        </ResponseField>

        <ResponseField name="supported_reasoning_levels" type="array">
          Array of supported reasoning levels

          <Expandable title="Reasoning Level Object">
            <ResponseField name="effort" type="string">
              Effort level identifier (e.g., `low`, `medium`, `high`)
            </ResponseField>

            <ResponseField name="description" type="string">
              Description of the reasoning level
            </ResponseField>
          </Expandable>
        </ResponseField>

        <ResponseField name="default_reasoning_level" type="string">
          Default reasoning effort level
        </ResponseField>

        <ResponseField name="supports_reasoning_summaries" type="boolean">
          Whether the model supports reasoning summaries
        </ResponseField>

        <ResponseField name="support_verbosity" type="boolean">
          Whether the model supports verbosity control
        </ResponseField>

        <ResponseField name="default_verbosity" type="string">
          Default verbosity setting (if supported)
        </ResponseField>

        <ResponseField name="prefer_websockets" type="boolean">
          Whether WebSocket connections are preferred for this model
        </ResponseField>

        <ResponseField name="supports_parallel_tool_calls" type="boolean">
          Whether the model supports parallel tool/function calls
        </ResponseField>

        <ResponseField name="supported_in_api" type="boolean">
          Whether the model is available via API
        </ResponseField>

        <ResponseField name="minimal_client_version" type="string">
          Minimum client version required to use this model
        </ResponseField>

        <ResponseField name="priority" type="integer">
          Model priority for load balancing (higher = preferred)
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

#### Example Response

```json theme={null}
{
  "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

<CodeGroup>
  ```bash curl theme={null}
  curl -X GET https://your-codex-lb-instance.com/backend-api/codex/models \
    -H "Authorization: Bearer YOUR_API_KEY"
  ```

  ```python Python theme={null}
  import requests

  url = "https://your-codex-lb-instance.com/backend-api/codex/models"
  headers = {
      "Authorization": "Bearer YOUR_API_KEY"
  }

  response = requests.get(url, headers=headers)
  models = response.json()

  for model in models["data"]:
      print(f"{model['id']}: {model['metadata']['display_name']}")
      print(f"  Context: {model['metadata']['context_window']} tokens")
      print(f"  Modalities: {', '.join(model['metadata']['input_modalities'])}")
      if model['metadata']['supported_reasoning_levels']:
          levels = [r['effort'] for r in model['metadata']['supported_reasoning_levels']]
          print(f"  Reasoning: {', '.join(levels)}")
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://your-codex-lb-instance.com/backend-api/codex/models', {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer YOUR_API_KEY'
    }
  });

  const data = await response.json();

  data.data.forEach(model => {
    console.log(`${model.id}: ${model.metadata.display_name}`);
    console.log(`  Context: ${model.metadata.context_window} tokens`);
    console.log(`  Modalities: ${model.metadata.input_modalities.join(', ')}`);
    if (model.metadata.supported_reasoning_levels.length > 0) {
      const levels = model.metadata.supported_reasoning_levels.map(r => r.effort);
      console.log(`  Reasoning: ${levels.join(', ')}`);
    }
  });
  ```
</CodeGroup>

## 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

```python theme={null}
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

```python theme={null}
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
