# Claude Code and Codex compatibility

Zalmir's models answer in the chat format. Claude Code speaks Anthropic Messages and Codex speaks OpenAI Responses, so Zalmir translates each request to the model and translates the answer back. This page lists what happens to each request feature. Setup: [Claude Code](https://zalmir.ai/docs/agents#claude-code) and [Codex](https://zalmir.ai/docs/agents#codex).

How we check it: for every row, an automated test replays the request shape the client sends through our real gateway code, with a stand-in model, and checks the answer, what is sent to the model and what is charged. We have not run Claude Code or Codex themselves against Zalmir.

## Claude Code (Anthropic Messages)

| Request feature | Status | What happens |
| --- | --- | --- |
| POST /v1/messages?beta=true with x-api-key or Bearer, anthropic-version and repeated anthropic-beta headers, JSON or streaming | Translated | An Anthropic message, or Anthropic stream events ending in message_stop. The beta and version headers are accepted and not passed on. One hold, one charge. |
| max_tokens missing or 0 | Refused, no charge | 400 before anything is held or charged. Claude Code always sends max_tokens, so this only affects hand-written requests. |
| Tool names such as Read and mcp__server__tool, including 65-character names and dots | Translated | Sent to the model unchanged as function names; a call comes back as tool_use with the same name and parsed input. |
| thinking and output_config.effort | Translated | Become reasoning_effort for the model. The model's reasoning comes back as a thinking block, without a signature. |
| cache_control on system, messages and tools | Translated | The hints are not passed on. When the provider reports cached prompt tokens and the model has a cached price, usage shows cache_read_input_tokens and they are billed at that price. |
| PDF document blocks (base64) | Translated | Read in memory and sent as text (see PDF input). A file that is not a readable PDF is refused with 400 before anything is held or charged. |
| A retry that repeats the same Idempotency-Key header | Kept | Charged once: the repeat gets 409 and starts no second request. A retry without the header is a new request and is charged again. |
| POST /v1/messages/count_tokens | Not supported, no charge | 501; nothing is sent or charged. Claude Code then shows its own estimate in /context. |
| Images inside tool results (Read on an image file, MCP screenshot tools) | Translated | Each image is moved into a user message right after the tool results, and the tool result gets a short note naming it. Held and charged like any image in the prompt. A model without image input gets 400 before anything is held or charged. |
| Claude model names, server tools such as web search, and PDFs inside tool results | Refused, no charge | 400 before anything is held or charged. The Claude model error names ANTHROPIC_MODEL; map every ANTHROPIC_DEFAULT_*_MODEL to a Zalmir model. |

## Codex (OpenAI Responses)

| Request feature | Status | What happens |
| --- | --- | --- |
| POST /v1/responses with store: false, the whole conversation each turn, function and custom (apply_patch) tools, JSON or streaming | Translated | A Responses object, or Responses stream events ending in response.completed. Instructions become the system message; custom tools are sent as functions. One hold, one charge. |
| max_output_tokens missing or 0 | Translated | Missing: the model's own output limit applies. 0: refused with 400 before anything is held or charged. |
| reasoning.effort and summary, include reasoning.encrypted_content, prompt_cache_key | Translated | Effort becomes reasoning_effort. Reasoning comes back as a plain-text summary; no encrypted reasoning is made up. include and prompt_cache_key are accepted and not passed on. |
| Cached prompt tokens | Translated | When the provider reports cached prompt tokens and the model has a cached price, usage shows input_tokens_details.cached_tokens and they are billed at that price. |
| Function names such as mcp__server__tool | Translated | Sent unchanged; a call comes back as a function_call item with the same name, call ID and arguments. |
| input_file PDFs (base64 data URL) | Translated | Read in memory and sent as text (see PDF input). A file that is not a readable PDF is refused with 400 file_type_unsupported before anything is held or charged. |
| A retry that repeats the same Idempotency-Key header | Kept | Charged once: the repeat gets 409 idempotency_replay_unavailable and starts no second request. |
| store: true, previous_response_id, hosted tools (web_search, local_shell) and images in tool output | Refused, no charge | 400 before anything is held or charged. Keep web_search = "disabled" in your Codex config. |

## Charges

Every translated request is held and charged once, from the model's own usage figures, the same as a chat request. Anything refused here is refused before anything is held or charged. A retry is charged again unless it repeats the same `Idempotency-Key` header. See [Errors and headers](https://zalmir.ai/docs/guides/errors).

Source page: https://zalmir.ai/docs/agents/compatibility
