# Models

> List available models and their metadata using GET /v1/models.

Canonical: https://ai-gateway.sassmaker.com/docs/models

## Endpoint

```
GET /v1/models
```

Returns the list of models currently registered in the gateway in OpenAI-compatible format. Each model entry includes gateway-specific metadata such as provider, model type, reasoning tier, streaming support, and embedding dimensions where relevant.

## Response

```json
{
  "object": "list",
  "data": [
    {
      "id": "llama-3.3-70b-versatile",
      "object": "model",
      "created": 1714000000,
      "owned_by": "groq",
      "type": "chat",
      "provider": "groq",
      "reasoning_tier": null,
      "supports_streaming": true
    },
    {
      "id": "gemini-2.0-flash",
      "object": "model",
      "created": 1714000000,
      "owned_by": "gemini",
      "provider": "gemini",
      "reasoning_tier": null,
      "supports_streaming": true
    },
    {
      "id": "gemini-2.0-flash-thinking-exp",
      "object": "model",
      "created": 1714000000,
      "owned_by": "gemini",
      "provider": "gemini",
      "reasoning_tier": "high",
      "supports_streaming": true
    },
    {
      "id": "@cf/meta/llama-3.3-70b-instruct-fp8-fast",
      "object": "model",
      "created": 1714000000,
      "owned_by": "workers_ai",
      "provider": "workers_ai",
      "reasoning_tier": null,
      "supports_streaming": true
    },
    {
      "id": "voyage-3",
      "object": "model",
      "created": 1714000000,
      "owned_by": "voyage_ai",
      "type": "embedding",
      "provider": "voyage_ai",
      "reasoning_tier": null,
      "supports_streaming": false,
      "dimensions": 1024,
      "enabled": true
    }
  ]
}
```

## Response Fields

| Field | Type | Description |
|---|---|---|
| `id` | string | Model identifier to use in request bodies. |
| `object` | string | Always `"model"`. |
| `created` | number | Unix timestamp when the model was registered. |
| `owned_by` | string | The provider that owns/hosts the model. |
| `type` | string | `"chat"` or `"embedding"`. |
| `provider` | string | Gateway provider key. One of `groq`, `gemini`, `workers_ai`, `openrouter`, `cerebras`, `sambanova`, `nvidia`, `voyage_ai`. |
| `reasoning_tier` | string \| null | Reasoning capability tier (`"low"`, `"medium"`, `"high"`), or `null` for standard models. |
| `supports_streaming` | boolean | Whether the model supports SSE streaming. |
| `evaluation_weight` | number | Continuous eval routing multiplier derived from `MODEL_EVALUATIONS_JSON`; `1` means no eval nudge. |
| `evaluation_sample_count` | number | Number of recent eval samples behind the current weight. |
| `evaluated_at` | string \| null | Timestamp for the current eval snapshot, when supplied. |
| `dimensions` | number | Embedding vector dimensions. Present on `type: "embedding"` rows. |
| `supports_dimensions` | boolean | Whether the embedding model can accept a requested output dimension. Present on embedding rows. |
| `aliases` | string[] | Compatible model aliases, such as OpenAI embedding names mapped to gateway providers. Present on embedding rows. |
| `enabled` | boolean | Whether the provider credential/binding needed for the row is currently configured. |

Continuous evals are optional and never bypass hard filters. The router still excludes unhealthy,
rate-limited, incompatible, or capability-mismatched models before applying eval weights.
Embedding rows are included so RAG services can choose vector models from the live gateway catalog. Embedding vector spaces are not interchangeable; persist the selected model with each index.

## Model Capabilities

Each model has capability metadata used for automatic routing:

| Capability | Description | Auto-detected from |
|---|---|---|
| **Tool calling** | Function/tool use support | `tools` array in request |
| **JSON mode** | Structured output (`response_format: { type: "json_object" }`) | `response_format` field |
| **Vision** | Image input via `image_url` content parts | Image content in messages |
| **Context window** | Maximum input tokens the model can handle | Estimated from prompt size |

When your request requires a capability, the gateway automatically filters to models that support it. If no capable model is available, a `503` is returned.

### Capability Summary by Provider

| Provider | Tool Calling | JSON Mode | Vision | Context Window |
|---|:---:|:---:|:---:|---|
| **Gemini** | All models | All models | All models | 1M tokens |
| **Groq** | All models | All models | Llama 4 models | 32K–131K |
| **SambaNova** | All models | All models | — | 32K–131K |
| **NVIDIA NIM** | Most models | All models | — | 32K–131K |
| **Cerebras** | All models | All models | — | 32K–131K |
| **OpenRouter** | Select models | Most models | Select models | 32K–131K |
| **Workers AI** | — | — | — | 2K–131K |

## Examples



### curl

```bash
curl https://your-gateway.workers.dev/v1/models \
  -H "Authorization: Bearer <GATEWAY_API_KEY>"
```


### JavaScript

```js
const response = await fetch('https://your-gateway.workers.dev/v1/models', {
  headers: {
    'Authorization': 'Bearer <GATEWAY_API_KEY>',
  },
});

const { data: models } = await response.json();

// Print all model IDs grouped by provider
const byProvider = models.reduce((acc, model) => {
  (acc[model.provider] ??= []).push(model.id);
  return acc;
}, {});

for (const [provider, ids] of Object.entries(byProvider)) {
  console.log(`\n${provider}:`);
  ids.forEach((id) => console.log(`  - ${id}`));
}
```


### OpenAI SDK

```js

const client = new OpenAI({
  baseURL: 'https://your-gateway.workers.dev/v1',
  apiKey: '<GATEWAY_API_KEY>',
});

const models = await client.models.list();

// Filter to only streaming-capable chat models
const chatModels = models.data.filter(
  (m) => m.type === 'chat' && m.supports_streaming,
);

console.log('Available chat models:');
chatModels.forEach((m) => console.log(`  ${m.id} (${m.provider})`));
```



## Filtering by Provider

You can filter client-side after fetching the full list:

```js
const response = await fetch('https://your-gateway.workers.dev/v1/models', {
  headers: { 'Authorization': 'Bearer <GATEWAY_API_KEY>' },
});

const { data: models } = await response.json();

const groqModels = models.filter((m) => m.provider === 'groq');
const reasoningModels = models.filter((m) => m.reasoning_tier !== null);
const embeddingModels = models.filter((m) => !m.supports_streaming);
```

## Using a Specific Model

Pass any `id` value directly as the `model` field in a chat or embeddings request:

```bash
curl https://your-gateway.workers.dev/v1/chat/completions \
  -H "Authorization: Bearer <GATEWAY_API_KEY>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "llama-3.3-70b-versatile",
    "messages": [{ "role": "user", "content": "Hello from Groq!" }]
  }'
```

Or use `"auto"` to let the gateway pick the healthiest available provider automatically.
