# curl (/docs/guides/curl)

Call every endpoint from the command line.



Set your key once:

```bash title="Terminal"
export CHEAPAIMODEL_API_KEY="sk-..."
```

## List models [#list-models]

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

## Chat completion [#chat-completion]

```bash
curl https://api.cheapaimodel.ai/v1/chat/completions \
  -H "Authorization: Bearer $CHEAPAIMODEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "deepseek-v4-1-flash", "messages": [{"role": "user", "content": "Hello!"}]}'
```

Add `"stream": true` and pass `-N` to curl to see tokens as they arrive.

## Response [#response]

```bash
curl https://api.cheapaimodel.ai/v1/responses \
  -H "Authorization: Bearer $CHEAPAIMODEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "deepseek-v4-1-flash", "input": "Hello!"}'
```

## Message (Anthropic format) [#message-anthropic-format]

No model in the [catalog](/models) currently lists `/v1/messages`. The request below shows the shape; replace `<model-id>` with a model whose catalog page lists this endpoint.

```bash
curl https://api.cheapaimodel.ai/v1/messages \
  -H "x-api-key: $CHEAPAIMODEL_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{"model": "<model-id>", "max_tokens": 1024, "messages": [{"role": "user", "content": "Hello!"}]}'
```

## Embeddings [#embeddings]

No model in the [catalog](/models) currently lists `/v1/embeddings`. The request below shows the shape; replace `<model-id>` with a model whose catalog page lists this endpoint.

```bash
curl https://api.cheapaimodel.ai/v1/embeddings \
  -H "Authorization: Bearer $CHEAPAIMODEL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "<model-id>", "input": "The quick brown fox"}'
```
