codex-as-api 0.10.1__tar.gz → 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/PKG-INFO +51 -203
  2. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/README.md +47 -199
  3. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/RELEASES.md +32 -0
  4. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/pyproject.toml +4 -4
  5. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/scripts/check_package_versions.py +48 -2
  6. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/scripts/check_release_artifacts.py +1 -1
  7. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/src/codex_as_api/__init__.py +1 -1
  8. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/src/codex_as_api/anthropic_adapter.py +397 -31
  9. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/src/codex_as_api/provider.py +689 -17
  10. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/src/codex_as_api/reasoning_signature.py +38 -0
  11. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/src/codex_as_api/server.py +402 -21
  12. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_anthropic_adapter.py +180 -106
  13. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_package_versions.py +63 -0
  14. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_provider.py +314 -6
  15. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_registry_release.py +16 -16
  16. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_release_artifacts.py +3 -3
  17. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_server.py +366 -22
  18. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_standalone_login_api.py +4 -1
  19. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/.gitignore +0 -0
  20. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/LICENSE +0 -0
  21. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/THIRD_PARTY_NOTICES.md +0 -0
  22. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/config/codex-upstream-contract.json +0 -0
  23. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/config/o200k_base.tiktoken +0 -0
  24. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/config/verified-hidden-models.json +0 -0
  25. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/requirements.txt +0 -0
  26. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/rust/THIRD_PARTY_NOTICES.md +0 -0
  27. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/scripts/check_no_static_model_catalog.py +0 -0
  28. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/scripts/check_registry_release.py +0 -0
  29. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/scripts/generate_rust_third_party_notices.py +0 -0
  30. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/scripts/package_rust_release.py +0 -0
  31. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/src/codex_as_api/auth.py +0 -0
  32. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/src/codex_as_api/browser_login.py +0 -0
  33. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/src/codex_as_api/codex_config.py +0 -0
  34. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/src/codex_as_api/codex_version.py +0 -0
  35. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/src/codex_as_api/device_login.py +0 -0
  36. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/src/codex_as_api/messages.py +0 -0
  37. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/src/codex_as_api/model_capabilities.py +0 -0
  38. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/src/codex_as_api/o200k_tokenizer.py +0 -0
  39. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/src/codex_as_api/protocol.py +0 -0
  40. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/src/codex_as_api/strict_json.py +0 -0
  41. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/__init__.py +0 -0
  42. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/conftest.py +0 -0
  43. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/fixtures/o200k_base_encode_ordinary.json +0 -0
  44. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_auth.py +0 -0
  45. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_browser_login.py +0 -0
  46. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_codex_config.py +0 -0
  47. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_codex_version.py +0 -0
  48. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_device_login.py +0 -0
  49. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_login_commit_races.py +0 -0
  50. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_login_generation.py +0 -0
  51. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_login_http_real_store.py +0 -0
  52. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_management_body.py +0 -0
  53. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_messages.py +0 -0
  54. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_model_capabilities.py +0 -0
  55. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_no_static_model_catalog.py +0 -0
  56. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_o200k_tokenizer.py +0 -0
  57. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_protocol.py +0 -0
  58. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_rust_third_party_notices.py +0 -0
  59. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_strict_json.py +0 -0
  60. {codex_as_api-0.10.1 → codex_as_api-1.0.0}/tests/test_ultrafast.py +0 -0
@@ -1,10 +1,10 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: codex-as-api
3
- Version: 0.10.1
3
+ Version: 1.0.0
4
4
  Summary: Use ChatGPT/Codex OAuth as a local OpenAI-compatible API server.
5
- Project-URL: Homepage, https://github.com/Eunho-J/codex-as-api
6
- Project-URL: Repository, https://github.com/Eunho-J/codex-as-api
7
- Author: Eunho-J
5
+ Project-URL: Homepage, https://github.com/CHOAM-CO/codex-as-api
6
+ Project-URL: Repository, https://github.com/CHOAM-CO/codex-as-api
7
+ Author: CHOAM
8
8
  License: Apache-2.0
9
9
  License-File: LICENSE
10
10
  Keywords: api,chatgpt,codex,llm,oauth,openai
@@ -35,16 +35,16 @@ Description-Content-Type: text/markdown
35
35
 
36
36
  # codex-as-api
37
37
 
38
- [![GitHub Release](https://img.shields.io/github/v/release/Eunho-J/codex-as-api)](https://github.com/Eunho-J/codex-as-api/releases)
38
+ [![GitHub Release](https://img.shields.io/github/v/release/CHOAM-CO/codex-as-api)](https://github.com/CHOAM-CO/codex-as-api/releases)
39
39
  [![PyPI](https://img.shields.io/pypi/v/codex-as-api)](https://pypi.org/project/codex-as-api/)
40
40
  [![npm](https://img.shields.io/npm/v/codex-as-api)](https://www.npmjs.com/package/codex-as-api)
41
- [![License](https://img.shields.io/github/license/Eunho-J/codex-as-api)](LICENSE)
41
+ [![License](https://img.shields.io/github/license/CHOAM-CO/codex-as-api)](LICENSE)
42
42
 
43
43
  Use ChatGPT / Codex OAuth as a local OpenAI-compatible API server.
44
44
 
45
45
  ## Features
46
46
 
47
- - **OpenAI & Anthropic compatible** — Chat Completions, Messages, and `GET /v1/models`
47
+ - **OpenAI & Anthropic compatible** — Responses (`/v1/responses`, `/v1/responses/compact`), Chat Completions, Messages, and `GET /v1/models`
48
48
  - **Claude Code ready** — use Codex models directly from Claude Code CLI
49
49
  - **Streaming** — full SSE streaming for both OpenAI and Anthropic protocols
50
50
  - **Tool calling** — function calls, tool results, and parallel tool calls
@@ -100,7 +100,7 @@ codex-as-api
100
100
  Or from source:
101
101
 
102
102
  ```bash
103
- git clone https://github.com/Eunho-J/codex-as-api.git
103
+ git clone https://github.com/CHOAM-CO/codex-as-api.git
104
104
  cd codex-as-api
105
105
  pip install -e .
106
106
  codex-as-api
@@ -298,7 +298,7 @@ These three upstream-hidden models returned real responses on October 24, 2026,
298
298
 
299
299
  A small authenticated smoke test also verified function-tool calling plus tool-result continuation for all three models, and executed a simple generated JavaScript function against four inputs per model. This is a basic functionality check, not a coding-quality benchmark.
300
300
 
301
- **These are hidden models. Upstream support can stop at any time, and availability may differ by account. If a model stops responding, [open an issue](https://github.com/Eunho-J/codex-as-api/issues) with its model ID and a sanitized error; we will remove the discontinued model from this catalog.** Do not include access tokens or other credentials in the issue.
301
+ **These are hidden models. Upstream support can stop at any time, and availability may differ by account. If a model stops responding, [open an issue](https://github.com/CHOAM-CO/codex-as-api/issues) with its model ID and a sanitized error; we will remove the discontinued model from this catalog.** Do not include access tokens or other credentials in the issue.
302
302
 
303
303
  The proxy exposes these verified exceptions as selectable models and prefers their current live capability metadata. Bundled capability records keep only these three IDs available when a successful live catalog omits them; they do not bypass OAuth, upstream rejection, or a failed/malformed catalog fetch. A successful empty upstream catalog can therefore list these experimental entries, while health/default selection still fails until an ordinary upstream default is available. The proxy never selects a hidden experimental model as its automatic default.
304
304
 
@@ -392,7 +392,7 @@ it; continuation uses the complete provider Response items saved behind
392
392
 
393
393
  Anthropic Messages compatibility endpoint for any client, including Claude Code and Scheherazade. It supports streaming (`stream: true`) and non-streaming without a client-identification header. A live Codex model ID routes directly. A `claude-*` facade ID uses the configured Codex backend model, or the authenticated catalog default when no backend model is configured. Other unknown IDs fail. The response preserves the client-supplied model name.
394
394
 
395
- `max_tokens` is a required positive compatibility hint: the private Codex OAuth transport does not expose a matching output-token cap. Valid ephemeral `cache_control` hints are accepted and stripped for every client; their TTL and breakpoint semantics are not forwarded. An optional `x-claude-code-session-id` provides stable hashed cache affinity, not permission to use the endpoint. `metadata.user_id` is accepted as client metadata and is not forwarded.
395
+ `max_tokens` is a required positive compatibility hint: the private Codex OAuth transport does not expose a matching output-token cap. Valid ephemeral `cache_control` hints are accepted and stripped for every client; their TTL and breakpoint semantics are not forwarded. An optional `x-claude-code-session-id` provides stable hashed cache affinity, not permission to use the endpoint. Anthropic `metadata` objects with string or null entries (including `user_id` and additional client metadata keys) are accepted and not forwarded.
396
396
 
397
397
  ```bash
398
398
  curl http://localhost:18080/v1/messages \
@@ -435,12 +435,21 @@ On the following assistant-history request, recognized envelopes restore the ori
435
435
 
436
436
  Multiple summary parts share one thinking block per reasoning item. Encrypted-only items use an empty thinking string with a non-empty signature. Streaming sends `signature_delta` before the matching `content_block_stop`. `display: "omitted"` hides the summary but can preserve an encrypted-only signed block for continuity; disabled thinking suppresses thinking output. Items without encrypted content retain unsigned-summary compatibility behavior.
437
437
 
438
- Hosted Anthropic `web_search` declarations are rejected with HTTP 400 on
439
- Messages, token-counting, and compact requests. OpenAI Responses cannot supply
440
- the Anthropic server-tool provenance and encrypted lifecycle fields required to
441
- translate a hosted result losslessly, so the gateway does not approximate that
442
- protocol. Provider output containing an unexpected hosted web-search call is an
443
- upstream protocol error instead of a fabricated Anthropic result block.
438
+ Hosted Anthropic `web_search` declarations (`web_search`, `web_search_20250305`,
439
+ and `web_search_20260209`, including `allowed_domains`, `user_location`,
440
+ `tool_choice: {"type": "tool", "name": "web_search"}`, and positive integer
441
+ `max_uses`, which is validated and accepted for Anthropic compatibility without
442
+ upstream enforcement) are supported when Classic Responses is active
443
+ (`responses_lite: false`, or `"auto"` on models that use Classic Responses) and
444
+ map to Codex hosted `web_search` with `web_search_call.action.sources`,
445
+ projecting `search`, `open_page`, and `find_in_page` `web_search_call` actions into
446
+ `server_tool_use` and `web_search_tool_result` blocks alongside
447
+ `usage.server_tool_use` (and preserving the raw `web_search_call` items on `/v1/responses`).
448
+ `blocked_domains` and `strict: true` on `web_search`,
449
+ or hosted `web_search` when Responses Lite is active, return HTTP 400. Replayed
450
+ `server_tool_use`, `web_search_tool_result`, text/content `document`, and
451
+ `search_result` blocks in conversation history are rendered into structured
452
+ text context.
444
453
 
445
454
  Completed responses require authoritative final token usage and a real
446
455
  `response.completed` event. Emitted function calls map to `tool_calls` or
@@ -512,7 +521,7 @@ curl http://localhost:18080/v1/messages/count_tokens \
512
521
 
513
522
  ### `POST /v1/messages/compact`
514
523
 
515
- Anthropic-compatible alias for remote conversation compaction. Accepts Anthropic Messages-shaped bodies and returns compacted checkpoint content. Live GPT model IDs select the matching backend model, and Claude Code effort and Fast Mode controls use the same mappings as `/v1/messages`. Its required non-forwarded `max_tokens` and any valid `cache_control` hints are accepted for every client; the optional Claude Code session header only supplies cache affinity.
524
+ Anthropic-compatible alias for remote conversation compaction. Accepts Anthropic Messages-shaped bodies and returns compacted checkpoint content. Live GPT model IDs select the matching backend model, and Claude Code effort and Fast Mode controls use the same mappings as `/v1/messages`. Its optional non-forwarded `max_tokens` (validated as a positive integer when provided), sampling/stop compatibility fields (`temperature`, `top_p`, `top_k`, empty `stop_sequences: []`), `tool_choice`, and valid `cache_control` hints are accepted for every client; the optional Claude Code session header only supplies cache affinity.
516
525
 
517
526
  ### `POST /v1/images/generations`
518
527
 
@@ -661,7 +670,7 @@ Requests can instead use the Responses-shaped effort/context object:
661
670
  - Responses Lite uses `all_turns` as the Codex wire default. An explicitly different context is rejected instead of silently overwritten; use `responses_lite: false` when the backend route supports classic Responses and another context is required.
662
671
  - Remote compact keeps its existing private Codex `reasoning_effort` field but does not accept public `reasoning.mode` or `reasoning.context`.
663
672
 
664
- Anthropic `thinking` values map as `enabled → high` and `adaptive → medium`. Disabled thinking selects `none` when available, otherwise the lowest supported catalog effort, and suppresses reasoning output; it does not claim to eliminate a model's internal reasoning. `output_config.effort` takes precedence over adaptive or enabled thinking and supports `low`, `medium`, `high`, `xhigh`, and `max`. Call-level disabled thinking takes precedence over ambient `output_config.effort` for auxiliary calls such as WebFetch. Explicit unsupported effort requests still fail. Hosted Anthropic WebSearch is rejected because its lifecycle cannot be translated losslessly. The supported reasoning context and verbosity extensions are also available on `/v1/messages`, image generation, and inspection requests; Pro, non-null public cache policy/breakpoints, and any supplied `safety_identifier` fail explicitly on the private Codex provider.
673
+ Anthropic `thinking` values map as `enabled → high` and `adaptive → medium`. Disabled thinking selects `none` when available, otherwise the lowest supported catalog effort, and suppresses reasoning output; it does not claim to eliminate a model's internal reasoning. `output_config.effort` takes precedence over adaptive or enabled thinking and supports `low`, `medium`, `high`, `xhigh`, and `max`. Call-level disabled thinking takes precedence over ambient `output_config.effort` for auxiliary calls such as WebFetch. Explicit unsupported effort requests still fail. Hosted Anthropic `web_search` declarations are bridged when Classic Responses is active (`responses_lite: false`, or `"auto"` on Classic-default models), while Responses Lite rejects hosted `web_search` with HTTP 400. The supported reasoning context and verbosity extensions are also available on `/v1/messages`, image generation, and inspection requests; Pro, non-null public cache policy/breakpoints, and any supplied `safety_identifier` fail explicitly on the private Codex provider.
665
674
 
666
675
  Anthropic's `JSONOutputFormat` carries a schema but no name. When Claude Code
667
676
  sends that official shape, the proxy follows pinned Codex 0.153.3 and supplies
@@ -670,10 +679,11 @@ or fallback role. An explicit proxy-extension name is preserved only when it is
670
679
  already a valid Responses format name, and is never sanitized or truncated.
671
680
 
672
681
  The pinned official Codex HTTP request has no `stop` field. Omitted OpenAI
673
- `stop`, or explicit OpenAI `stop: null`, is omitted from the private request;
674
- any other OpenAI `stop` value returns HTTP 400. Anthropic `stop_sequences`
675
- follows its typed API contract: omission is allowed, while explicit `null` or
676
- an array value returns HTTP 400 because the private transport cannot apply it.
682
+ `stop`, explicit `stop: null`, and empty `stop: []` are omitted from the private
683
+ request as no-ops; any non-empty OpenAI `stop` value returns HTTP 400. Anthropic
684
+ `stop_sequences` allows omission and empty `stop_sequences: []`, while explicit
685
+ `stop_sequences: null` or any non-empty array returns HTTP 400 because the
686
+ private transport cannot apply stop sequences.
677
687
 
678
688
  The mapping is intentionally transport-aware:
679
689
 
@@ -683,7 +693,7 @@ The mapping is intentionally transport-aware:
683
693
  | `prompt_cache_key` | Forward an explicit value; otherwise use non-empty `client_metadata.session_id` |
684
694
  | Non-null `prompt_cache_options` / breakpoint | HTTP 400; `null` is omitted and there is no private field |
685
695
  | Any supplied `safety_identifier` | HTTP 400; the optional field is non-nullable and OAuth account/thread IDs are not semantic aliases |
686
- | Non-null `stop` / `stop_sequences` | HTTP 400; no private field |
696
+ | Non-empty `stop` / `stop_sequences` (or `stop_sequences: null`) | HTTP 400; empty `[]` (and OpenAI `stop: null`) are omitted |
687
697
  | `previous_response_id` | Resolve locally and replay complete Response history over HTTP |
688
698
  | `service_tier: "fast"` | Send `service_tier: "priority"` |
689
699
  | `service_tier: "default"` | Omit the field |
@@ -894,12 +904,15 @@ CODEX_AS_API_MODEL=gpt-5.6-terra \
894
904
  codex-as-api
895
905
  ```
896
906
 
897
- Claude Code hosted WebSearch is not supported through this gateway, regardless
898
- of Responses Lite mode. Classic Responses can execute an OpenAI hosted search,
899
- but its output lacks the Anthropic provenance and encrypted lifecycle data
900
- needed for a lossless Messages response. WebFetch remains a client-side
901
- auxiliary request and retains the disabled-thinking precedence behavior when
902
- process-level effort is enabled.
907
+ Claude Code hosted `web_search` (`web_search`, `web_search_20250305`, and
908
+ `web_search_20260209`) is supported when Classic Responses is active
909
+ (`responses_lite: false`, or `"auto"` on models whose catalog sets Classic
910
+ Responses), mapping Codex `web_search` calls and `web_search_call.action.sources`
911
+ into Anthropic `server_tool_use` and `web_search_tool_result` blocks alongside
912
+ `usage.server_tool_use`. On Responses Lite models under `responses_lite: "auto"`,
913
+ hosted `web_search` returns HTTP 400 unless `responses_lite: false` is valid
914
+ and supplied. WebFetch remains a client-side auxiliary request and retains the
915
+ disabled-thinking precedence behavior when process-level effort is enabled.
903
916
 
904
917
  To keep the built-in Fable, Opus, Sonnet, and Haiku rows and append one GPT row, launch the GPT-routed Claude Code process with these variables:
905
918
 
@@ -981,10 +994,12 @@ The provider handles:
981
994
  ## Release & package publishing
982
995
 
983
996
  The `Release` GitHub Actions workflow runs on a pushed `v*` tag. It rejects a
984
- tag that does not exactly match every Python, npm, and Rust version surface,
997
+ tag that does not exactly match every Python, npm, and Rust version surface or
998
+ lacks a matching `## v<version>` section in [RELEASES.md](RELEASES.md),
985
999
  runs the complete cross-runtime gate, and then publishes PyPI, npmjs, the
986
1000
  scoped GitHub npm package, deterministic platform Rust ZIP archives, and one
987
- GitHub Release. Each Rust archive contains the platform binary, `LICENSE`, and
1001
+ GitHub Release whose body is populated from that `RELEASES.md` section. Each
1002
+ Rust archive contains the platform binary, `LICENSE`, and
988
1003
  the generated `THIRD_PARTY_NOTICES.md` covering both bundled tokenizer data and
989
1004
  the locked normal dependency graph across supported release targets.
990
1005
 
@@ -994,10 +1009,10 @@ registry setup is still required:
994
1009
 
995
1010
  - Create GitHub environments named `pypi` and `npm`; add deployment protection
996
1011
  rules if desired.
997
- - On PyPI, add a trusted publisher for project `codex-as-api`, owner `Eunho-J`,
1012
+ - On PyPI, add a trusted publisher for project `codex-as-api`, owner `CHOAM-CO`,
998
1013
  repository `codex-as-api`, workflow `release.yml`, environment `pypi`.
999
1014
  - On npmjs, add a GitHub Actions trusted publisher for package `codex-as-api`,
1000
- owner `Eunho-J`, repository `codex-as-api`, workflow `release.yml`,
1015
+ owner `CHOAM-CO`, repository `codex-as-api`, workflow `release.yml`,
1001
1016
  environment `npm`, with `npm publish` allowed.
1002
1017
  - GitHub Packages and GitHub Releases use the job-scoped automatic
1003
1018
  `GITHUB_TOKEN`; repository policy must allow the workflow's declared
@@ -1006,9 +1021,9 @@ registry setup is still required:
1006
1021
  After bumping every version and passing the local gate, push the matching tag:
1007
1022
 
1008
1023
  ```bash
1009
- python scripts/check_package_versions.py --tag v0.10.1
1010
- git tag v0.10.1
1011
- git push origin v0.10.1
1024
+ python scripts/check_package_versions.py --tag v1.0.0
1025
+ git tag v1.0.0
1026
+ git push origin v1.0.0
1012
1027
  ```
1013
1028
 
1014
1029
  ## Tests
@@ -1036,173 +1051,6 @@ npm install
1036
1051
  npm test
1037
1052
  ```
1038
1053
 
1039
-
1040
- ## Release Notes
1041
-
1042
- ### v0.10.1
1043
-
1044
- - Preserve mid-history `system` messages added after conversation history starts as in-place `developer` input items across Python, TypeScript, and Rust chat requests, keeping the earlier conversation history prefix stable for prompt caching while leaving remote compaction (`compact_messages`) unchanged.
1045
- - Document current preview limitations of OpenAI's public "Sign in with ChatGPT" (`chatgpt.tokens.use.direct`) route and why the Codex OAuth transport remains the default.
1046
-
1047
- ### v0.10.0
1048
-
1049
- - Sign in directly with ordinary browser OAuth; no Codex installation or existing
1050
- Codex credentials are required. Device-code login is an explicit remote option.
1051
- - Add independent admin-key-protected login start/status/cancel endpoints and a
1052
- private application-owned credential store across Python, TypeScript and Rust.
1053
- - Upgrading requires a new codex-as-api login; existing Codex credentials remain
1054
- untouched. See [Standalone login](#standalone-login) and [full release notes](RELEASES.md).
1055
-
1056
- ### v0.8.0
1057
-
1058
- - Add ChatGPT Live realtime voice to the TypeScript runtime: `POST
1059
- /v1/realtime/calls` creates an OAuth-authorized call from a client-owned WebRTC
1060
- SDP offer and returns the SDP answer, and `WS /v1/realtime/sideband/{call_id}`
1061
- relays the OpenAI realtime event sideband for headless clients. Audio stays on
1062
- the client's media plane.
1063
- - Mirror the pinned Codex call contract exactly: one identity in
1064
- `x-session-id`/`session-id`/`thread-id`, the `openai-alpha: quicksilver=v2`
1065
- handshake, `intent=quicksilver&architecture=avas`, and a session payload that
1066
- never chooses its own voice-session id.
1067
- - Document realtime as a TypeScript-only capability; Python and Rust remain
1068
- HTTP-only in this release instead of claiming cross-runtime parity.
1069
-
1070
- ### v0.7.0
1071
-
1072
- - Replace bundled model capability tables with a fresh authenticated Codex
1073
- catalog and add `GET /v1/models` across all three runtimes.
1074
- - Remove stale/unknown-model fallbacks, fabricated Anthropic signatures, silent
1075
- request downgrades, and malformed upstream recovery; return typed failures.
1076
- - Reject hosted Anthropic WebSearch instead of translating incomplete OpenAI
1077
- search lifecycle data, and require authoritative completion and final usage.
1078
- - Keep immediate Claude Code `message_start` delivery without inventing token
1079
- counts; final Anthropic fields are emitted only from authoritative provider data.
1080
- - Scope continuation history and catalog state to the authenticated account,
1081
- validate before streaming, and make `/health` report actual readiness.
1082
- - Require the official nested `tokens` auth layout, remove root-level and
1083
- noncanonical auth aliases, and reject external-host `chatgptAuthTokens`.
1084
- - Pin the validated private contract to Codex `0.153.3` and publish the exact
1085
- tested artifacts to PyPI, npmjs, GitHub Packages, and GitHub Releases.
1086
- - Install Python server dependencies with the base package so the default
1087
- `pip install codex-as-api` command produces a runnable server.
1088
-
1089
- ### v0.6.5
1090
-
1091
- - Align GPT-5.6 alias, Sol, Terra, and Luna context limits with Codex `0.147.0`
1092
- at 272,000 tokens and derive the 244,800-token automatic compact threshold.
1093
- - Pin the verified upstream request, Responses Lite, header, and model contract
1094
- to `openai/codex` commit
1095
- `be6e8eac029b183056b7e4402879f15d2c85f61b`; track its new fractional SSE
1096
- rollout-budget field without claiming an unapproved facade mapping.
1097
- - Refresh OAuth credentials five minutes before expiry, coalesce concurrent
1098
- refreshes, reload changed credentials after 401, and preserve upstream HTTP
1099
- status codes across all three servers.
1100
- - Replace startup npm version discovery with deterministic compatibility and
1101
- package-version identity in the Codex-style `User-Agent`.
1102
- - Add full cross-runtime CI plus tag-gated OIDC publishing to PyPI and npmjs,
1103
- `GITHUB_TOKEN` publishing to GitHub Packages, and GitHub Release assets.
1104
-
1105
- ### v0.6.4
1106
-
1107
- - Remove process-global generated Codex session/thread identities and require
1108
- explicit session identity when Codex metadata mode is enabled.
1109
- - Resolve Chat cache affinity as explicit `prompt_cache_key`, then
1110
- `client_metadata.session_id`, then omission.
1111
- - Derive Claude Code cache affinity from `x-claude-code-session-id` without
1112
- fabricating Codex metadata; keep normal Anthropic Messages stateless.
1113
- - Validate and strip Anthropic `cache_control` compatibility hints without
1114
- claiming unavailable breakpoint or TTL semantics.
1115
- - Update current compatibility evidence to Codex `0.145.0`, Codex `main` at
1116
- `bd2de422aa287b97b06ca6425a10935bcf1b3731`, and Claude Code `2.1.220`.
1117
-
1118
- ### v0.6.3
1119
-
1120
- - Accept Claude Code auxiliary requests that combine ambient `output_config.effort` with call-level `thinking.disabled`.
1121
- - Give explicit disabled thinking precedence and send Codex reasoning effort `none` instead of returning HTTP 400.
1122
- - Document and test `CODEX_AS_API_RESPONSES_LITE=off` for Claude Code hosted WebSearch on GPT-5.6; WebFetch needs no Responses Lite override.
1123
- - Preserve fail-loudly validation for invalid effort values and unsupported `output_config` fields.
1124
- - Add Python, TypeScript, and Rust adapter regressions, streamed `/v1/messages` coverage, and a `/count_tokens` regression for the WebSearch/WebFetch request shape.
1125
-
1126
- ### v0.6.2
1127
-
1128
- - Fix `/v1/messages/count_tokens` overcounting that could trigger Claude Code autocompaction on every turn.
1129
- - Count normalized model-visible messages, tool calls, reasoning, tool-result metadata, and tool schemas once; remove the second full raw-request-body addition.
1130
- - Port official `tiktoken` `o200k_base` ordinary encoding into Python, TypeScript, and Rust without adding a `tiktoken` package dependency or runtime rank download.
1131
- - Match the upstream Unicode text split and BPE merge ranks last checked on 2026-07-14 against `tiktoken` 0.13.0 at `08a5f3b`.
1132
- - Keep image input cost separate and count inline base64 images once rather than adding both a fixed image estimate and the base64 request bytes.
1133
- - Add matching Python, TypeScript, and Rust endpoint regressions: a 4,000-byte ASCII message now returns `1,012` instead of roughly `8,000`, and non-model control fields do not change the count.
1134
- - Validate the release with Claude Code `2.1.209` and real Codex OAuth chat.
1135
-
1136
- ### v0.6.1
1137
-
1138
- - Re-audit official Codex `0.144.4` and `main` at `393f64565ab46f09d99ca4d9bd973537e72a114b`, plus Claude Code `2.1.208`, before publishing.
1139
- - Validate Claude Code `2.1.208` with real Codex OAuth chat and tool loops, and document the official custom GPT picker entry alongside Fable, Opus, Sonnet, and Haiku.
1140
- - Route bundled GPT model IDs from Anthropic requests to the selected Codex backend model while retaining configured fallback behavior for built-in Claude model names.
1141
- - Map `output_config.effort` and Fast Mode to Codex effort and priority service tier, preserve URL images and tool-error state, and handle current context/tool beta fields without silent loss.
1142
- - Keep Messages, token counting, and remote compaction aligned on effective model limits and fail-loudly validation for output formats and image sources.
1143
- - Keep Python streaming work off the ASGI event loop and make Rust Anthropic SSE truly incremental so concurrent Claude Code requests are not stalled or buffered.
1144
- - Preserve Rust streaming authentication, rate-limit, and overload errors after OAuth refresh instead of collapsing them to generic HTTP 500 failures.
1145
- - Restrict the Python source distribution to release inputs so local agent state and unrelated runtime sources cannot enter PyPI artifacts.
1146
-
1147
- ### v0.6.0
1148
-
1149
- - Add GPT-5.6 public alias plus Sol, Terra, and Luna capability metadata, model defaults, and Codex context-window behavior.
1150
- - Refresh bundled context and default-effort metadata for current GPT-5.5, GPT-5.4, GPT-5.4 Mini, and GPT-5.2 catalog entries.
1151
- - Update Responses Lite request bodies and headers across chat, compact, and inspection paths; Lite image generation is rejected explicitly because this proxy has no standalone image-tool executor.
1152
- - Add `max`, Codex-compatible `ultra` to `max` wire conversion, future model-defined efforts, and `model_reasoning_effort` config support.
1153
- - Add GPT-5.6 reasoning effort/context, `standard` mode compatibility, capability-gated image `original` detail, standard verbosity, cache accounting, and real backend `response_id` support across Python, TypeScript, and Rust.
1154
- - Translate known `previous_response_id` values into bounded local full-history replay; reject Pro and non-null public cache policy/breakpoints or `safety_identifier` because the private Codex request contract has no equivalent field.
1155
- - Reject hosted Multi-agent and Programmatic Tool Calling on the Chat facade until their native agent/program item lifecycle can be preserved.
1156
-
1157
- ### v0.5.2
1158
-
1159
- - Support latest Codex root-level OAuth token files while keeping PAT-only, agent-identity-only, and Bedrock-only auth files explicitly unsupported.
1160
- - Add shared model capability gating for Responses Lite, parallel tool calls, verbosity, and service-tier behavior across Python, TypeScript, and Rust.
1161
- - Preserve encrypted reasoning state via top-level `reasoning.encrypted_content` include and add Codex metadata forwarding controls.
1162
-
1163
- ### v0.5.1
1164
-
1165
- - Add official Codex CLI `originator` and versioned `User-Agent` headers for ChatGPT/Codex OAuth requests.
1166
- - Resolve the latest `@openai/codex` version from npm at server startup, with `CODEX_AS_API_CODEX_CLI_VERSION` as an explicit override.
1167
-
1168
- ### v0.5.0
1169
-
1170
- - Preserve Claude Code server-tool history (`server_tool_use`, `web_search_tool_result`, MCP/advisor-like result blocks) as backend context instead of dropping it on the next turn.
1171
- - Support Anthropic `output_format` structured outputs by mapping JSON schema/object formats to OpenAI Responses `text.format`.
1172
- - Preserve `document` and `search_result` content blocks inside tool results, keep Python streaming defaults aligned, and accept unsuffixed `web_search` server-tool types across Python, TypeScript, and Rust.
1173
-
1174
- ### v0.4.0
1175
-
1176
- - Add Claude Code-compatible Anthropic hosted web search support by mapping `web_search_*` server tools to OpenAI Responses `web_search`.
1177
- - Return `server_tool_use` and `web_search_tool_result` blocks so Claude Code can parse web search results reliably.
1178
- - Prepare TypeScript package publishing to npmjs and GitHub Packages via GitHub Actions.
1179
-
1180
- ### v0.3.3
1181
-
1182
- - Stop forwarding client `max_tokens` as Codex `max_output_tokens`, restoring Claude Code compatibility with the Codex OAuth backend.
1183
- - Add Python, TypeScript, and Rust regression tests for the provider payload.
1184
-
1185
- ### v0.3.2
1186
-
1187
- - Restore immediate Anthropic streaming so Claude Code receives events without waiting for the backend response to finish.
1188
- - Use conservative local token estimates for `/v1/messages/count_tokens`; Codex OAuth has no count-only backend endpoint.
1189
- - Keep real final streaming usage metadata in `message_delta`.
1190
-
1191
- ### v0.3.1
1192
-
1193
- - Attempted real backend token counting for `/v1/messages/count_tokens` with `max_output_tokens: 0`; this is superseded by v0.3.2 because Codex OAuth rejects count-only requests.
1194
- - Forward converted Anthropic tools, tool choice, stop sequences, and thinking/reasoning settings during token-count requests.
1195
- - Propagate cumulative Anthropic streaming usage, including cache accounting, server tool use, and service tier metadata when available.
1196
- - Pass `max_output_tokens` through provider requests across Python, TypeScript, and Rust.
1197
-
1198
- ### v0.3.0
1199
-
1200
- - Read Codex CLI config from `CODEX_HOME` / `~/.codex/config.toml` across Python, TypeScript, and Rust.
1201
- - Use the configured Codex backend model while preserving Anthropic client model names in `/v1/messages` responses.
1202
- - Expose `context_window` and `auto_compact_token_limit` through `/health` and `/v1/messages/count_tokens`.
1203
- - Add Anthropic-compatible `/v1/messages/count_tokens` and `/v1/messages/compact`.
1204
- - Map context-window failures to Anthropic-style `400 invalid_request_error` responses and stream error events.
1205
-
1206
1054
  ## License
1207
1055
 
1208
1056
  Apache License 2.0 — derived from [OpenAI Codex CLI](https://github.com/openai/codex) (Apache-2.0, Copyright 2025 OpenAI).