# Base URL (/docs/api/base-url)

The single host behind every cheapaimodel endpoint, and the exact base URL each SDK and tool expects.



Every endpoint lives on one host:

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

There is no regional host and no separate host per provider. The same API key and the same balance work for both wire formats below.

## Which value to use [#which-value-to-use]

OpenAI-style clients expect the base URL to include `/v1`; Anthropic-style clients expect the bare host and append `/v1/messages` themselves.

| Wire format        | Base URL                         | Requests go to                                                          |
| ------------------ | -------------------------------- | ----------------------------------------------------------------------- |
| OpenAI-compatible  | `https://api.cheapaimodel.ai/v1` | `/v1/chat/completions`, `/v1/responses`, `/v1/embeddings`, `/v1/models` |
| Anthropic Messages | `https://api.cheapaimodel.ai`    | `/v1/messages`                                                          |

## By SDK and tool [#by-sdk-and-tool]

| Client                                                            | Setting                                  | Value                                       |
| ----------------------------------------------------------------- | ---------------------------------------- | ------------------------------------------- |
| [OpenAI SDK](/docs/guides/openai-sdk) (Python)                    | `base_url`                               | `https://api.cheapaimodel.ai/v1`            |
| [OpenAI SDK](/docs/guides/openai-sdk) (TypeScript)                | `baseURL`                                | `https://api.cheapaimodel.ai/v1`            |
| OpenAI SDKs via environment                                       | `OPENAI_BASE_URL`                        | `https://api.cheapaimodel.ai/v1`            |
| [LangChain](/docs/guides/langchain) (Python / TypeScript)         | `base_url` / `configuration.baseURL`     | `https://api.cheapaimodel.ai/v1`            |
| [LlamaIndex](/docs/guides/llamaindex)                             | `api_base` in `OpenAILike`               | `https://api.cheapaimodel.ai/v1`            |
| [Vercel AI SDK](/docs/guides/vercel-ai-sdk)                       | `baseURL` in `createOpenAICompatible`    | `https://api.cheapaimodel.ai/v1`            |
| [LiteLLM](/docs/guides/litellm)                                   | `api_base` (model `openai/<id>`)         | `https://api.cheapaimodel.ai/v1`            |
| [Anthropic SDK](/docs/guides/anthropic-sdk) (Python / TypeScript) | `base_url` / `baseURL`                   | `https://api.cheapaimodel.ai`               |
| Anthropic SDKs via environment                                    | `ANTHROPIC_BASE_URL`                     | `https://api.cheapaimodel.ai`               |
| [Claude Code](/docs/guides/claude-code)                           | `ANTHROPIC_BASE_URL`                     | `https://api.cheapaimodel.ai`               |
| [Codex CLI](/docs/guides/codex-cli)                               | `base_url` in `config.toml`              | `https://api.cheapaimodel.ai/v1`            |
| [Cursor](/docs/guides/cursor)                                     | Override OpenAI Base URL                 | `https://api.cheapaimodel.ai/v1`            |
| [Cline](/docs/guides/cline)                                       | Base URL                                 | `https://api.cheapaimodel.ai/v1`            |
| [Continue](/docs/guides/continue)                                 | `apiBase` in `config.yaml`               | `https://api.cheapaimodel.ai/v1`            |
| [Zed](/docs/guides/zed)                                           | `api_url` in `settings.json`             | `https://api.cheapaimodel.ai/v1`            |
| [Aider](/docs/guides/aider)                                       | `OPENAI_API_BASE` or `--openai-api-base` | `https://api.cheapaimodel.ai/v1`            |
| [Open WebUI](/docs/guides/open-webui)                             | URL of the OpenAI API connection         | `https://api.cheapaimodel.ai/v1`            |
| [Dify](/docs/guides/dify)                                         | API Base URL (OpenAI-API-compatible)     | `https://api.cheapaimodel.ai/v1`            |
| [n8n](/docs/guides/n8n)                                           | Base URL in the OpenAI credential        | `https://api.cheapaimodel.ai/v1`            |
| [OpenClaw](/docs/guides/openclaw)                                 | `baseUrl` in `models.providers`          | `https://api.cheapaimodel.ai/v1`            |
| [curl](/docs/guides/curl)                                         | full URL                                 | `https://api.cheapaimodel.ai/v1/<endpoint>` |

## Common mistakes [#common-mistakes]

* **`/v1` on an Anthropic client.** The SDK appends `/v1/messages`, so the request goes to `/v1/v1/messages` and fails with `404` and `Invalid URL (POST /v1/v1/messages)`. Use the bare host.
* **Missing `/v1` on an OpenAI client.** The request goes to `/chat/completions`, which is not an API path, and fails with `404` and the plain-text body `fault filter abort` instead of JSON. Add `/v1`.
* **The endpoint path in the base URL.** Set `https://api.cheapaimodel.ai/v1`, not `https://api.cheapaimodel.ai/v1/chat/completions`; the SDK adds the path, and the doubled path fails with `404`.
* **The site or console host.** `cheapaimodel.ai` and `console.cheapaimodel.ai` serve web pages, not the API.

Once the base URL is right, send your key as described in [Authentication & API keys](/docs/concepts/authentication).
