# Overview (/docs/api)

Base URL, authentication, errors and every endpoint of the cheapaimodel API.



The cheapaimodel API speaks two wire formats on one host: OpenAI-compatible endpoints and the Anthropic Messages endpoint. Both use the same API keys and the same balance.

## Base URL [#base-url]

```text
https://api.cheapaimodel.ai
```

OpenAI-style clients take `https://api.cheapaimodel.ai/v1`; Anthropic-style clients take the bare host. See [Base URL](/docs/api/base-url) for the value each SDK and tool expects.

## Authentication [#authentication]

Send your API key as a bearer token. `/v1/messages` also accepts the Anthropic-style `x-api-key` header.

```bash
curl https://api.cheapaimodel.ai/v1/models \
  -H "Authorization: Bearer $CHEAPAIMODEL_API_KEY"
```

Create keys on the console's [API Keys](https://console.cheapaimodel.ai/keys) page. See [Authentication & API keys](/docs/concepts/authentication) for expiry, budgets and allowlists.

## Endpoints [#endpoints]

| Method | Path                   |                                                              |
| ------ | ---------------------- | ------------------------------------------------------------ |
| `GET`  | `/v1/models`           | [List models](/docs/api/list-models)                         |
| `POST` | `/v1/chat/completions` | [Create a chat completion](/docs/api/create-chat-completion) |
| `POST` | `/v1/responses`        | [Create a response](/docs/api/create-response)               |
| `POST` | `/v1/messages`         | [Create a message](/docs/api/create-message)                 |
| `POST` | `/v1/embeddings`       | [Create embeddings](/docs/api/create-embedding)              |

Set `"stream": true` on the generation endpoints to receive server-sent events; see [Streaming](/docs/concepts/streaming).

## Errors [#errors]

Errors return a non-2xx status and a JSON body with `error.message`. Branch on the status code and `error.code`; see [Errors](/docs/concepts/errors) for the full table.

## OpenAPI [#openapi]

The machine-readable contract for these endpoints is at [`/docs/openapi.yaml`](/docs/openapi.yaml). Feed it to an SDK generator or an AI assistant.
