# Compatible servers

Add a server that speaks OpenAI's or Anthropic's API at a custom base URL, such as a self-hosted model, as a provider on any plan.

Connect a server that implements OpenAI's Chat Completions or Responses API, or Anthropic's Messages API, at a custom base URL (such as a self-hosted model or an internal proxy). Adding a provider requires Owner or LLM Gateway Admin on the organization, or on a project for a project-scoped provider. Compatible servers are available on every plan within your provider quota ([Limits and quotas](/reference/limits#llm-gateway)).

For DeepSeek, Kimi, Z.ai and Alibaba Cloud Model Studio, use their built-in providers instead ([Add a provider](/guides/llm-gateway/add-a-provider#providers)).

## Add a compatible server [#add-a-compatible-server]

1. In your organization, click **LLM Gateway**, then **Providers**, then **Add a provider**.
2. Under **Compatible APIs**, click the API the server speaks: **OpenAI-compatible Chat Completions**, **OpenAI-compatible Responses** or **Anthropic-compatible API**.
3. Enter its **Base URL**: for OpenAI APIs, enter the URL prefix before `/chat/completions`, `/responses` and `/models` (such as `https://llm.example.com/v1`); for Anthropic APIs, enter the prefix before `/v1/messages` (such as `https://llm.example.com/anthropic`).
4. Paste the server's key into **API key**, select which projects can create models with this provider, click **Test** and click **Add provider**.

See [Add a provider](/guides/llm-gateway/add-a-provider) for adding a project provider, sharing and key rotation.

## What kosem uses [#what-kosem-uses]

- **Types, for the API:** `providerTypes/openai-compatible`, `providerTypes/openai-responses-compatible` or `providerTypes/anthropic-compatible`, with the base URL as `base_url` in `config`.
- **Base URL requirements:** must start with `https://` and resolve to a public address, with no username, password, query string or fragment. kosem doesn't follow redirects and sends the key only to that host.
- **Authentication and checks:** kosem sends the key as a bearer token (and also in `X-Api-Key` for Anthropic-compatible servers). On OpenAI APIs, kosem verifies the key with `GET models`; on Anthropic APIs, kosem sends an empty message request that the server rejects without invoking a model.
- **Models:** listed from `GET models`. If the server doesn't return a model list, click **Add by ID** and enter the model ID.
- **Strict tools:** on Anthropic-compatible servers, this setting is off by default. Turn it on for servers that support Anthropic's strict tool schema, such as Claude proxies.

## Price its models [#price-its-models]

A compatible server sets its own prices, so kosem records its requests with no cost. To count them in usage and spend limits, give the model a price: match a catalog model kosem knows, as below, or set custom prices per million tokens as `input` and `output`.

```sh
export KOSEM_API_KEY='kosem_sk_…'
export KOSEM_MODEL='projects/prj_01m5r9dh9mf0ps98ktkap3562c/models/mdl_01m5rb2x9ke4vbt6g0d4x7qz1k'

curl -s -X PATCH "https://api.kosem.ai/v1/$KOSEM_MODEL" \
  -H "Authorization: Bearer $KOSEM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"pricing": {"pricedLike": {"provider": "providers/openai", "providerModel": "gpt-5-mini"}}}'
```

## Move a model to its maker's provider [#move-a-model-to-its-makers-provider]

DeepSeek, Kimi, GLM or Qwen models added through an **OpenAI-compatible Chat Completions** provider have no built-in pricing, and DeepSeek and Kimi reject agent requests after tool calls. To migrate to the built-in provider while keeping the same alias:

1. Add the built-in provider: [Add a provider](/guides/llm-gateway/add-a-provider#providers).
2. Rename the old model's alias (such as `deepseek` to `deepseek-old`): click **Edit** beside an organization model, or update a project model with the API (`PATCH /v1/projects/{project}/models/{model}`).
3. Add the model under the new provider using the original alias.
4. Delete the old model, then delete the old provider once no models use it.

## Related [#related]

- [Add a provider](/guides/llm-gateway/add-a-provider)
- [Add models to a project](/guides/llm-gateway/add-models-to-a-project)
- [Call models from your code](/guides/llm-gateway/call-models-from-code)
