> For the complete documentation index, see [llms.txt](https://anyint.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://anyint.gitbook.io/docs/api-reference/models-api.md).

# models api

This route is the source of truth for what your account can use. It should be the first API you call in a new environment.

## Published route

`GET https://gateway.api.anyint.ai/openai/v1/models`

## Why this route matters

Use it before hardcoding model IDs. This is the safest way to confirm what your account can access.

## Current published header example

The current API catalog publishes this route with Anthropic-style headers:

```http
x-api-key: <ANYINT_API_KEY>
anthropic-version: 2023-06-01
```

## cURL example

```bash
curl https://gateway.api.anyint.ai/openai/v1/models \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## JavaScript example

```javascript
const response = await fetch("https://gateway.api.anyint.ai/openai/v1/models", {
  headers: {
    "Authorization: Bearer YOUR_API_KEY,
});

const data = await response.json();
console.log(data.data.map((model) => model.id));
```

## Python example

```python
import os
import requests

response = requests.get(
    "https://gateway.api.anyint.ai/openai/v1/models",
    headers={
        "Authorization: Bearer ": os.environ["ANYINT_API_KEY"],
    },
    timeout=30,
)

response.raise_for_status()
for model in response.json()["data"]:
    print(model["id"])
```

## Response fields

| Field                  | Meaning                         |
| ---------------------- | ------------------------------- |
| `data[].id`            | The model ID to use in requests |
| `data[].display_name`  | Human-friendly label            |
| `data[].type`          | Object type                     |
| `data[].created_at`    | Published timestamp             |
| `has_more`             | Pagination flag                 |
| `first_id` / `last_id` | Cursor-related identifiers      |

## Recommended usage pattern

1. Fetch models during environment setup.
2. Cache the response in your application or admin UI.
3. Let users pick from `data[].id` instead of free-typing a model name.
4. Re-sync regularly if you depend on newly added models.

## Common mistakes

* Treating a dashboard label as the request `model` value
* Assuming every account sees the same model list
* Mixing Bearer auth into this route even though the current published example uses `x-api-key`
