# OpenAI and Anthropic compatibility

> What the Tukai API takes from the OpenAI and Anthropic APIs, what it does not, and what to change in an existing integration.

Source : https://developers.tuk-ai.com/en/docs/compatibility · Verified on 2026-10-04

The Tukai API imitates **four operations** of the OpenAI and Anthropic APIs, so that the official SDKs work without modification. It is **not** a full copy of those APIs: any operation missing from this page does not exist at Tukai.

## What changes in your integration

| Setting | OpenAI SDK | Anthropic SDK |
|---|---|---|
| Base URL | `https://chat.tuk-ai.com/v1` | `https://chat.tuk-ai.com` (the SDK adds `/v1` itself) |
| Key | `tuk_sk_…` in `apiKey` | `tuk_sk_…` in `apiKey` |
| Model identifier | A Tukai identifier, for example `chat-anthropic-claude-haiku-4-5` | The same Tukai identifier |

Model identifiers are **Tukai's own**, never those of the original provider: `gpt-…` or `claude-…` on their own are refused. The list is on the [Models](https://developers.tuk-ai.com/models) (French) page.

The rest of the code (messages, `max_tokens`, reading the response) does not change for a simple text call.

## Available operations

| Operation | Shape | Status |
|---|---|---|
| `POST /v1/chat/completions` | OpenAI | Supported text, with or without `stream` |
| `POST /v1/messages` | Anthropic | Supported text, with or without `stream`; `max_tokens` required |
| `POST /v1/messages/count_tokens` | Anthropic | Supported local estimate, free, no model call |
| `GET /v1/models` | Tukai catalog | Partial public and without a key; the objects have Tukai fields (`display_name`, `available`…) in addition to `id` |
| `POST /v1/responses`, `embeddings`, `images`, `audio`, `files`, `batches`, `assistants` | OpenAI | Not supported |
| `GET /v1/models/{id}`, Message Batches, Files | Anthropic | Not supported |

## Advanced features

| Feature | Status | Details |
|---|---|---|
| Streaming (SSE) | Partial | Implemented and covered by the repository's tests; not yet run against production as part of this documentation. On the OpenAI side, the stream ends with `data: [DONE]`. |
| Image or audio input | Not supported | `image_url` or `input_audio` parts are **ignored**: the request still gets a response, based on the text alone. Do not send an image expecting it to be analyzed. |
| Tools (`tools`), OpenAI side | Not supported | The `chat.completion` response contains only text (`message.content`), never `tool_calls`. |
| Tools (`tools`), Anthropic side | Not tested | The `tool_use` ↔ `tool_calls` translation exists in the code; it has not been verified end to end here. |
| `finish_reason`, OpenAI side | Partial | Always `stop`, even when the output was cut off by `max_tokens`. |
| Structured output (`response_format`, JSON schema) | Not supported | Silently ignored: only `model`, `messages` (text) and `max_tokens` are passed to the model. |
| `temperature`, `top_p`, `stop` and other OpenAI settings | Not supported | Accepted by validation but silently ignored. |
| `thinking`, `cache_control`, Anthropic server-side tools | Not supported | Not supported; reported as a warning on the server side. |
| Direct calls from a browser | Not supported | Unsupported use: a key must never be in code that runs on your users' devices. |

## Headers

| Header | Effect |
|---|---|
| `Authorization: Bearer tuk_sk_…` | Canonical form (OpenAI SDK). |
| `x-api-key: tuk_sk_…` | Accepted (Anthropic SDK). Send one or the other, not both: through the published URL, only `Authorization` is kept when both are present. |
| `anthropic-version`, `anthropic-beta` | Accepted, not passed on to the provider. |
| `x-request-id` (response) | Request identifier, on every response. The OpenAI SDK exposes it (`requestID` in TypeScript); the Anthropic SDK does not read it, so you have to pick it up from the HTTP headers. |
| `ratelimit-limit`, `ratelimit-remaining`, `ratelimit-reset` (response) | Rate limit status of the key. |

## Errors

Errors keep the envelope of the imitated provider (`{"error": {...}}` for OpenAI, `{"type": "error", "error": {...}}` for Anthropic), so that the SDK reads them normally. Depending on the cause, the message is in English or in French: read the `type` field. Code details: [Errors](https://developers.tuk-ai.com/en/docs/errors).

## Verified versions

On October 3, 2026, against production, **without any paid call** (deliberately invalid key):

- `openai` 7.27.0 (Node.js): `models.list()` responds; `chat.completions.create()` reaches the right route and raises `AuthenticationError` (401).
- `@anthropic-ai/sdk` 0.131.0 (Node.js): `messages.create()` reaches the right route and raises `AuthenticationError` (401).

> **What has not been verified yet**
>
> A successful end-to-end generation, streaming and the Python SDKs have not been run against production for this page: no paid test account is authorized yet. The Python examples follow the standard configuration of the official SDKs.
