Releases: Eunho-J/codex-as-api
Releases · Eunho-J/codex-as-api
Release list
v0.6.5
v0.6.4 - Session and cache semantics
Codex identity and cache affinity
- Remove process-global generated
session_idandthread_idvalues from Python, TypeScript, and Rust. Codex metadata mode now requires an explicit non-emptyclient_metadata.session_id, defaults a rootthread_idto that session, preserves an explicit child thread, and refreshes only turn-scoped identity on each request. - Resolve Chat
prompt_cache_keyas explicit value, then non-emptyclient_metadata.session_id, then omission. This matches Codex 0.145.0 and currentmain, where the official default is Responses metadatasession_id, notthread_id. - Retain bounded process-local Chat
previous_response_idhistory replay over private HTTP. The ID remains local and is never forwarded upstream.
Claude Code session and cache compatibility
- Read
x-claude-code-session-idon/v1/messagesand derive a stable, privacy-safe SHA-256prompt_cache_key; an explicit proxy extensionprompt_cache_keytakes precedence. - Keep normal Anthropic Messages stateless: reject non-null
previous_response_id, disable ambient Codex metadata, avoid fabricated Claude thread IDs, and remove Python's nonstandard Anthropicresponse_id. - Validate Anthropic
cache_controlhints at request, system, message, content, and tool locations. Accept onlytype: "ephemeral"with optional TTL5mor1h, then strip the hint because the private Codex transport cannot preserve Anthropic cache breakpoints or TTL behavior.
Validation
- Python: 515 tests, mypy, and changed-file Ruff checks.
- TypeScript: 261 tests and production build.
- Rust: 253 tests and rustfmt.
- Re-audited
@openai/codex0.145.0 plusmainatbd2de422aa287b97b06ca6425a10935bcf1b3731, and reproduced the Claude Code 2.1.220 request shape.
v0.6.3 - Claude Code Web compatibility
Claude Code WebSearch/WebFetch auxiliary calls
- Fix HTTP 400 responses when a Claude Code session with ambient effort sends a WebSearch/WebFetch auxiliary request containing both
output_config.effortand call-levelthinking: {"type":"disabled"}. - Give explicit disabled thinking precedence over valid ambient effort and forward Codex reasoning effort
noneacross Python, TypeScript, and Rust. - Require and document
CODEX_AS_API_RESPONSES_LITE=offfor Claude Code hosted WebSearch on GPT-5.6 because official Responses Lite relies on a standaloneweb.runexecutor; WebFetch does not require this override. - Continue rejecting empty, non-string, or unsupported effort values and unsupported
output_configfields rather than silently discarding malformed requests.
Validation
- Adapter tests cover every valid Claude Code effort value paired with disabled thinking while retaining invalid-value failures.
- Streamed
/v1/messagestests across all three runtimes and a local/count_tokenstest reproduce the Claude Code 2.1.209 request shape and prove provider-backed requests reach the classic Codex wire with reasoning effortnone. - A real GPT-5.6 Sol Codex OAuth WebSearch completed with HTTP 200 and structured
server_tool_use,web_search_tool_result, and terminal SSE events.
v0.6.2
v0.6.2
- Replace the Anthropic
count_tokensbyte/double-count estimator with bundledo200k_baseordinary tokenization across Python, TypeScript, and Rust. - Port the official tiktoken 0.13.0 Unicode pre-tokenization and BPE merge logic without adding a tiktoken package dependency or runtime encoding download.
- Count normalized model-visible messages, tools, reasoning, and tool-result metadata once; ignore request controls and keep image estimates separate.
- Record the 2026-07-14 upstream sync commit, rank SHA-256, and MIT third-party notice in source and package artifacts.
Validation before release:
- Python: 486 tests passed; scoped Ruff and mypy passed; wheel/sdist checked and isolated wheel install passed.
- TypeScript: 255 tests passed; type-check, build, npm pack, and isolated package install passed.
- Rust: 244 tests passed; format, check, and release build passed.
- All three endpoints matched 204 multilingual and long-input cases; a 4,000-byte ASCII message returns 1,012 tokens instead of roughly 8,000.
- Claude Code 2.1.209 completed a real Codex OAuth request through the updated proxy.
v0.6.1
v0.6.1
- Add Claude Code 2.1.208 custom GPT model routing alongside Fable, Opus, Sonnet, and Haiku.
- Wire
output_config.effort, Fast Mode, current context cleanup, model-specific token limits, and remote compaction across Python, TypeScript, and Rust. - Preserve URL images and tool-error state, and reject unsupported task budgets, beta tool semantics, malformed output formats, and unknown image sources before transport.
- Keep Python streaming off the ASGI event loop and make Rust Anthropic SSE incremental with preserved OAuth, rate-limit, and overload errors.
- Restrict Python source distributions to release inputs so local state cannot enter PyPI artifacts.
Validation before release:
- Official
openai/codex0.144.4 and currentmainaudited at393f64565ab46f09d99ca4d9bd973537e72a114b. - Claude Code 2.1.208 completed a real Codex OAuth chat, explicit GPT-5.6 Sol max-effort call, and two-turn
Readtool loop. - Python: 470 tests passed; mypy passed; wheel/sdist built, checked, installed, and served a health request.
- TypeScript: 250 tests passed; build, type-check, and npm pack dry run passed.
- Rust: 239 tests passed; format, check, and release build passed.
v0.6.0
v0.6.0
- Add the GPT-5.6 alias plus Sol, Terra, and Luna model capabilities across Python, TypeScript, and Rust.
- Wire reasoning effort/context and public
standardmode, mapultrato private effortmax, and reject unsupported Pro explicitly. - Map
service_tier: fasttopriority, gate classicdetail: originalby model capability, and refresh current context/default-effort metadata. - Implement bounded process-local
previous_response_idcontinuation for private HTTP by replaying officialresponse.output_item.donehistory; never alias it tothread_idor forward it on HTTP. - Preserve
prompt_cache_key; reject non-null public cache options/breakpoints andsafety_identifierbecause the private Codex contract has no equivalent fields. - Reject non-empty stop controls before transport, update Responses Lite/Compact behavior, and add npm package documentation.
Validation before release:
- Official
openai/codexmain audited at6ad0e943cc727dc836d7c671f3377db30107f4d9. - Python: 419 tests passed; mypy passed; wheel built.
- TypeScript: 233 tests passed; build and npm pack dry run passed.
- Rust: 209 tests passed; format, clippy execution, and release build passed.
- Live ChatGPT Codex OAuth: two GPT-5.6 Sol HTTP calls completed with
standardmapped to medium/all_turns; the second call replayed three semantic input items and sent no HTTPprevious_response_id.
v0.5.2
v0.5.2
- Support latest Codex root-level OAuth token files while keeping PAT-only, agent-identity-only, and Bedrock-only auth files explicitly unsupported.
- Add shared model capability gating for Responses Lite, parallel tool calls, verbosity, and service-tier behavior across Python, TypeScript, and Rust.
- Preserve encrypted reasoning state via top-level
reasoning.encrypted_contentinclude and add Codex metadata forwarding controls.
Validation before release:
- Python pytest: 216 passed
- TypeScript npm test: 151 passed
- TypeScript build and npm pack dry-run passed
- Rust cargo test: 129 passed
- Rust cargo package verification passed
v0.5.1
Release Notes
v0.5.1
Codex backend version-header compatibility
- Add the official Codex CLI
originatorheader and versionedUser-Agentheader to ChatGPT/Codex OAuth requests across Python, TypeScript, and Rust. - Resolve the latest
@openai/codexversion from npm during server startup and cache it for outgoing requests. - Keep
CODEX_AS_API_CODEX_CLI_VERSIONas an explicit override for offline or pinned deployments.
Validation
- Python:
CODEX_AS_API_AUTH_PATH=/tmp/codex-as-api-missing-auth.json .venv/bin/pytest -q - Rust:
cargo test - TypeScript:
npm test && npm run build && npm pack --dry-run - Python package dry run:
uv build --out-dir /tmp/codex-as-api-dist
v0.5.0
Claude Code conversation-history compatibility
- Preserve Anthropic server-tool history blocks (
server_tool_use,web_search_tool_result, and other*_tool_resultblocks) as backend-readable context instead of silently dropping them on follow-up turns. - Preserve
redacted_thinkingplaceholders without exposing unavailable reasoning text. - Preserve
documentandsearch_resultcontent nested insidetool_resultblocks. - Keep Python Anthropic streaming routes aligned with provider defaults so
text.formatand omitted optional knobs can pass through consistently.
Structured outputs
- Map Anthropic
output_format/output_config.format-style JSON schema requests to OpenAI Responsestext.formatfor Claude Code side queries. - Keep JSON schema names OpenAI-compatible while preserving schema, description, and explicit
strictsettings.
Web search version tolerance
- Accept unsuffixed
type: "web_search"server tools in addition to versionedweb_search_*tool types.
Validation
- Python:
.venv/bin/pytest -q - Rust:
cargo test - TypeScript:
npm test && npm run build
v0.4.0
Anthropic hosted web search compatibility
- Route Anthropic
web_search_*server tools to the OpenAI Responses hostedweb_searchtool instead of treating them as function tools. - Convert hosted web search calls back into Anthropic
server_tool_useandweb_search_tool_resultblocks for Claude Code compatibility. - Preserve or synthesize
usage.server_tool_use.web_search_requestsand cover the behavior across Python, TypeScript, and Rust.
Package publishing preparation
- Add a GitHub Actions workflow that builds/tests the TypeScript package and can publish to npmjs (
codex-as-api) and GitHub Packages (@eunho-j/codex-as-api) by manual dispatch.
Validation
- Python:
.venv/bin/pytest -q - Rust:
cargo test - TypeScript:
npm test && npm run build
v0.3.3
Claude Code retry fix
- Stop forwarding Anthropic/OpenAI
max_tokensas Codexmax_output_tokensbecause the Codex OAuth Responses backend rejects that parameter. - Add Python, TypeScript, and Rust regression coverage to keep provider payloads free of
max_output_tokenseven when clients sendmax_tokens.
Validation
- Python:
PYTHONPATH=src pytest -q - Rust:
cargo test - TypeScript:
npm test && npm run build
v0.3.2
Claude Code compatibility fix
- Restored immediate Anthropic streaming so clients receive
message_startbefore the backend response completes. /v1/messages/count_tokensnow returns a conservative local estimate because Codex OAuth has no Anthropic-equivalent count-only endpoint.- Token estimates use UTF-8 byte length as a conservative upper bound for GPT/Codex BPE text tokens, plus overhead for roles, message boundaries, tools, raw request metadata, and images.
- Keeps real final streaming usage in
message_deltawhile avoiding stream buffering.
Validation
- Python:
PYTHONPATH=src pytest -q - Rust:
cargo test - TypeScript:
npm test && npm run build - Live smoke:
/v1/messages/count_tokensand streaming/v1/messagesagainst local server
v0.3.1
Anthropic token accounting attempt
/v1/messages/count_tokensasked the Codex backend for real input-token usage withmax_output_tokens: 0; this is superseded by v0.3.2 because Codex OAuth rejects count-only requests.- Token counting forwards Anthropic-converted tools, tool choice, stop sequences, and thinking/reasoning settings across Python, TypeScript, and Rust.
- Provider requests now pass
max_output_tokensthrough to Codex where requested.
Streaming usage parity
- Anthropic streaming now propagates real cumulative usage details from the backend, including cache creation/read fields, server tool use, and service tier metadata when present.
message_startand finalmessage_deltausage payloads now match the backend-reported accounting across all implementations.
Validation
- Python:
PYTHONPATH=src pytest -q - Rust:
cargo test - TypeScript:
npm test && npm run build
v0.3.0
Codex config parity
- Python, TypeScript, and Rust now read Codex CLI config from
CODEX_HOME/~/.codex/config.toml. model,model_context_window, andmodel_auto_compact_token_limitare reflected consistently across implementations.CODEX_AS_API_MODELstill overrides the Codex config model when set.
Claude Code / Anthropic compatibility
/v1/messagespreserves the client-supplied Anthropic model name in responses while using the configured Codex model for backend requests.- Added
POST /v1/messages/count_tokenswith estimatedinput_tokens,context_window, andauto_compact_token_limit. - Added
POST /v1/messages/compactas an Anthropic-compatible alias for remote conversation compaction.
Observability and error handling
/healthnow reportscodex_config_path,context_window, andauto_compact_token_limit.- Context-window failures now map to Anthropic-style
400 invalid_request_errorresponses. - Streaming Anthropic requests now emit error SSE events when backend errors occur mid-stream.
Validation
- Python:
PYTHONPATH=src pytest -q - Rust:
cargo test - TypeScript:
npm test && npm run build
v0.4.0
Release Notes
v0.4.0
Anthropic hosted web search compatibility
- Route Anthropic
web_search_*server tools to the OpenAI Responses hostedweb_searchtool instead of treating them as function tools. - Convert hosted web search calls back into Anthropic
server_tool_useandweb_search_tool_resultblocks for Claude Code compatibility. - Preserve or synthesize
usage.server_tool_use.web_search_requestsand cover the behavior across Python, TypeScript, and Rust.
Package publishing preparation
- Add a GitHub Actions workflow that builds/tests the TypeScript package and can publish to npmjs (
codex-as-api) and GitHub Packages (@eunho-j/codex-as-api) by manual dispatch.
Validation
- Python:
.venv/bin/pytest -q - Rust:
cargo test - TypeScript:
npm test && npm run build
v0.3.3
Claude Code retry fix
- Stop forwarding Anthropic/OpenAI
max_tokensas Codexmax_output_tokensbecause the Codex OAuth Responses backend rejects that parameter. - Add Python, TypeScript, and Rust regression coverage to keep provider payloads free of
max_output_tokenseven when clients sendmax_tokens.
Validation
- Python:
PYTHONPATH=src pytest -q - Rust:
cargo test - TypeScript:
npm test && npm run build
v0.3.2
Claude Code compatibility fix
- Restored immediate Anthropic streaming so clients receive
message_startbefore the backend response completes. /v1/messages/count_tokensnow returns a conservative local estimate because Codex OAuth has no Anthropic-equivalent count-only endpoint.- Token estimates use UTF-8 byte length as a conservative upper bound for GPT/Codex BPE text tokens, plus overhead for roles, message boundaries, tools, raw request metadata, and images.
- Keeps real final streaming usage in
message_deltawhile avoiding stream buffering.
Validation
- Python:
PYTHONPATH=src pytest -q - Rust:
cargo test - TypeScript:
npm test && npm run build - Live smoke:
/v1/messages/count_tokensand streaming/v1/messagesagainst local server
v0.3.1
Anthropic token accounting attempt
/v1/messages/count_tokensasked the Codex backend for real input-token usage withmax_output_tokens: 0; this is superseded by v0.3.2 because Codex OAuth rejects count-only requests.- Token counting forwards Anthropic-converted tools, tool choice, stop sequences, and thinking/reasoning settings across Python, TypeScript, and Rust.
- Provider requests now pass
max_output_tokensthrough to Codex where requested.
Streaming usage parity
- Anthropic streaming now propagates real cumulative usage details from the backend, including cache creation/read fields, server tool use, and service tier metadata when present.
message_startand finalmessage_deltausage payloads now match the backend-reported accounting across all implementations.
Validation
- Python:
PYTHONPATH=src pytest -q - Rust:
cargo test - TypeScript:
npm test && npm run build
v0.3.0
Codex config parity
- Python, TypeScript, and Rust now read Codex CLI config from
CODEX_HOME/~/.codex/config.toml. model,model_context_window, andmodel_auto_compact_token_limitare reflected consistently across implementations.CODEX_AS_API_MODELstill overrides the Codex config model when set.
Claude Code / Anthropic compatibility
/v1/messagespreserves the client-supplied Anthropic model name in responses while using the configured Codex model for backend requests.- Added
POST /v1/messages/count_tokenswith estimatedinput_tokens,context_window, andauto_compact_token_limit. - Added
POST /v1/messages/compactas an Anthropic-compatible alias for remote conversation compaction.
Observability and error handling
/healthnow reportscodex_config_path,context_window, andauto_compact_token_limit.- Context-window failures now map to Anthropic-style
400 invalid_request_errorresponses. - Streaming Anthropic requests now emit error SSE events when backend errors occur mid-stream.
Validation
- Python:
PYTHONPATH=src pytest -q - Rust:
cargo test - TypeScript:
npm test && npm run build
v0.3.3
Claude Code retry fix
- Stop forwarding Anthropic/OpenAI
max_tokensas Codexmax_output_tokensbecause the Codex OAuth Responses backend rejects that parameter. - Add Python, TypeScript, and Rust regression coverage to keep provider payloads free of
max_output_tokenseven when clients sendmax_tokens.
Validation
- Python:
PYTHONPATH=src pytest -q - Rust:
cargo test - TypeScript:
npm test && npm run build