Repository navigation
Description
Client or integration
Direct HTTP/API client
Area
Provider adapter
Summary
A provider row with adapter: "anthropic" gets the registry's Anthropic output-cap metadata (defaultMaxOutputTokens: 64000, modelMaxOutputTokens["claude-opus-5-5"]: 128000) only when the row's name equals a registry id (e.g. anthropic-apikey). Any other name gets no output-cap metadata, even when baseUrl is https://api.anthropic.com. That includes a self-named direct-API row and any Anthropic-compatible gateway.
Without that metadata, a request with no max_output_tokens falls back to DEFAULT_MAX_TOKENS = 8192. Codex never sends max_output_tokens (comment at src/adapters/anthropic.ts:1070), so this applies to every Codex turn routed to such a row. With adaptive thinking, the cap is thinking + visible output, so the upstream max_tokens is 8192 / 16384 / 24576 for effort omitted / medium / high. For the same model on the anthropic-apikey row it is 64000.
Reproduction
Clean Linux box (Debian 13, Node 22), npm i @bitkyc08/opencodex@<version>, OPENCODEX_HOME and HOME pointed at an empty temp dir. A local fake Anthropic endpoint on 127.0.0.1:18901 records request bodies and answers with a minimal end_turn SSE stream. No real model or key is used.
config.json:
{
"port": 18910, "hostname": "127.0.0.1",
"providers": {
"Gateway": {
"adapter": "anthropic", "baseUrl": "http://127.0.0.1:18901", "allowPrivateNetwork": true,
"authMode": "key", "apiKey": "sk-fake", "models": ["claude-opus-5-5"]
}
}
}Request (repeated with no reasoning, then "reasoning":{"effort":"medium"}, then "high"):
curl -s http://127.0.0.1:18910/v1/responses -H 'content-type: application/json' -d '{
"model":"Gateway/claude-opus-5-5","stream":true,"store":false,
"input":[{"role":"user","content":[{"type":"input_text","text":"hi"}]}]}'Upstream /v1/messages bodies recorded by the fake endpoint (identical on 2.99.0 and 2.100.1):
effort omitted: max_tokens=8192 thinking=None
effort medium: max_tokens=16384 thinking={'type': 'adaptive', 'display': 'summarized'} output_config={'effort': 'medium'}
effort high: max_tokens=24576 thinking={'type': 'adaptive', 'display': 'summarized'} output_config={'effort': 'high'}
Metadata resolution for three rows, calling enrichProviderFromRegistry(name, row) from src/providers/derive.ts in-process (no network), all with adapter: "anthropic", authMode: "key", models: ["claude-opus-5-5"]:
| name | baseUrl | defaultMaxOutputTokens | modelMaxOutputTokens["claude-opus-5-5"] |
|---|---|---|---|
anthropic-apikey |
https://api.anthropic.com |
64000 | 128000 |
MyClaude |
https://api.anthropic.com |
(unset) | (unset) |
Gateway |
https://gateway.example.com |
(unset) | (unset) |
Same result on 2.99.0 and 2.100.1.
Source locations (v2.100.1):
src/providers/derive.ts:547:enrichProviderFromRegistrylooks up the entry byrow.id === name. On a miss it callsenrichReasoningMetadataByDestinationand returns at line 555 without the output-cap fields.src/providers/registry/model-seeds.ts:28/:46:ANTHROPIC_DEFAULT_MAX_OUTPUT_TOKENS = 64_000,ANTHROPIC_MODEL_MAX_OUTPUT_TOKENS(claude-opus-5-5: 128_000).src/adapters/anthropic.ts:69:DEFAULT_MAX_TOKENS = 8192. Used at:1083and:1181when neither the request nor the row supplies an output cap.
Version
2.99.0 and 2.100.1
Operating system
Debian 13 (repro box); originally observed on macOS 26.5
Provider and model
Custom-named adapter: "anthropic" row → claude-opus-5-5
Logs or error output
Observed in real use on a custom-named row (/v1/chat/completions client, no max_tokens sent, medium effort): turns ended incomplete at exactly 16384 output tokens, 13830 of them reported as thinking tokens.
Checks
- I searched existing issues and documentation.
- I removed secrets, tokens, account details, request credentials, and personal data.
Activity
fix(anthropic): resolve omitted output caps by Claude model id, not r…