Fewer refusals for coding tools
Added
POST /v1/messagestakes Anthropic’s Messages API, streamed or not, on every chat model, so Claude Code can use Token Gear withANTHROPIC_BASE_URL; it is billed as the chat request it stands for.POST /v1/messages/count_tokenscounts a request’s input tokens on models whose tokenizer Token Gear has. On these routes the key may also be sent inx-api-key, and errors take Anthropic’s shape. A field these routes do not know is let go and named in theX-FreshToken-Ignored-Fieldsheader instead of refused (the Messages API).
Changed
- A request without an
Idempotency-Keyis answered instead of refused with400 invalid_request, so tools that take only a base URL and a key work. It runs as a new request each time: a retry of it runs and is charged again. Send a key to retry safely; an invalid key is still refused. - A chat completion’s field the API does not list, such as
thinking,enable_thinkingortop_k, is passed to the model as sent instead of refused with400 unsupported_parameter. Claude models still refuse one, exceptthinkingset to{"type": "disabled"}. Thinking tokens are billed as output. - A
reasoning_effortis passed to the model as sent when its provider declares no values for it; one its provider declares it does not take is refused with400 unsupported_parameternaming the field and the values it takes, instead ofno_compliant_provider. - A Responses request may send back the
reasoningitems an earlier answer returned, as Codex does on every turn: they are accepted and not sent to the model, instead of refused.