codex-as-api 0.10.2__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.2 → codex_as_api-1.0.0}/PKG-INFO +38 -25
  2. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/README.md +37 -24
  3. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/RELEASES.md +10 -0
  4. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/pyproject.toml +1 -1
  5. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/src/codex_as_api/__init__.py +1 -1
  6. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/src/codex_as_api/anthropic_adapter.py +397 -31
  7. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/src/codex_as_api/provider.py +689 -17
  8. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/src/codex_as_api/reasoning_signature.py +38 -0
  9. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/src/codex_as_api/server.py +398 -19
  10. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_anthropic_adapter.py +180 -106
  11. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_provider.py +277 -6
  12. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_server.py +310 -22
  13. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/.gitignore +0 -0
  14. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/LICENSE +0 -0
  15. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/THIRD_PARTY_NOTICES.md +0 -0
  16. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/config/codex-upstream-contract.json +0 -0
  17. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/config/o200k_base.tiktoken +0 -0
  18. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/config/verified-hidden-models.json +0 -0
  19. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/requirements.txt +0 -0
  20. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/rust/THIRD_PARTY_NOTICES.md +0 -0
  21. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/scripts/check_no_static_model_catalog.py +0 -0
  22. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/scripts/check_package_versions.py +0 -0
  23. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/scripts/check_registry_release.py +0 -0
  24. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/scripts/check_release_artifacts.py +0 -0
  25. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/scripts/generate_rust_third_party_notices.py +0 -0
  26. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/scripts/package_rust_release.py +0 -0
  27. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/src/codex_as_api/auth.py +0 -0
  28. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/src/codex_as_api/browser_login.py +0 -0
  29. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/src/codex_as_api/codex_config.py +0 -0
  30. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/src/codex_as_api/codex_version.py +0 -0
  31. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/src/codex_as_api/device_login.py +0 -0
  32. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/src/codex_as_api/messages.py +0 -0
  33. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/src/codex_as_api/model_capabilities.py +0 -0
  34. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/src/codex_as_api/o200k_tokenizer.py +0 -0
  35. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/src/codex_as_api/protocol.py +0 -0
  36. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/src/codex_as_api/strict_json.py +0 -0
  37. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/__init__.py +0 -0
  38. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/conftest.py +0 -0
  39. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/fixtures/o200k_base_encode_ordinary.json +0 -0
  40. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_auth.py +0 -0
  41. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_browser_login.py +0 -0
  42. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_codex_config.py +0 -0
  43. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_codex_version.py +0 -0
  44. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_device_login.py +0 -0
  45. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_login_commit_races.py +0 -0
  46. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_login_generation.py +0 -0
  47. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_login_http_real_store.py +0 -0
  48. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_management_body.py +0 -0
  49. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_messages.py +0 -0
  50. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_model_capabilities.py +0 -0
  51. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_no_static_model_catalog.py +0 -0
  52. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_o200k_tokenizer.py +0 -0
  53. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_package_versions.py +0 -0
  54. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_protocol.py +0 -0
  55. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_registry_release.py +0 -0
  56. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_release_artifacts.py +0 -0
  57. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_rust_third_party_notices.py +0 -0
  58. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_standalone_login_api.py +0 -0
  59. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_strict_json.py +0 -0
  60. {codex_as_api-0.10.2 → codex_as_api-1.0.0}/tests/test_ultrafast.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: codex-as-api
3
- Version: 0.10.2
3
+ Version: 1.0.0
4
4
  Summary: Use ChatGPT/Codex OAuth as a local OpenAI-compatible API server.
5
5
  Project-URL: Homepage, https://github.com/CHOAM-CO/codex-as-api
6
6
  Project-URL: Repository, https://github.com/CHOAM-CO/codex-as-api
@@ -44,7 +44,7 @@ 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
@@ -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
 
@@ -1008,9 +1021,9 @@ registry setup is still required:
1008
1021
  After bumping every version and passing the local gate, push the matching tag:
1009
1022
 
1010
1023
  ```bash
1011
- python scripts/check_package_versions.py --tag v0.10.2
1012
- git tag v0.10.2
1013
- git push origin v0.10.2
1024
+ python scripts/check_package_versions.py --tag v1.0.0
1025
+ git tag v1.0.0
1026
+ git push origin v1.0.0
1014
1027
  ```
1015
1028
 
1016
1029
  ## Tests
@@ -9,7 +9,7 @@ Use ChatGPT / Codex OAuth as a local OpenAI-compatible API server.
9
9
 
10
10
  ## Features
11
11
 
12
- - **OpenAI & Anthropic compatible** — Chat Completions, Messages, and `GET /v1/models`
12
+ - **OpenAI & Anthropic compatible** — Responses (`/v1/responses`, `/v1/responses/compact`), Chat Completions, Messages, and `GET /v1/models`
13
13
  - **Claude Code ready** — use Codex models directly from Claude Code CLI
14
14
  - **Streaming** — full SSE streaming for both OpenAI and Anthropic protocols
15
15
  - **Tool calling** — function calls, tool results, and parallel tool calls
@@ -357,7 +357,7 @@ it; continuation uses the complete provider Response items saved behind
357
357
 
358
358
  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.
359
359
 
360
- `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.
360
+ `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.
361
361
 
362
362
  ```bash
363
363
  curl http://localhost:18080/v1/messages \
@@ -400,12 +400,21 @@ On the following assistant-history request, recognized envelopes restore the ori
400
400
 
401
401
  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.
402
402
 
403
- Hosted Anthropic `web_search` declarations are rejected with HTTP 400 on
404
- Messages, token-counting, and compact requests. OpenAI Responses cannot supply
405
- the Anthropic server-tool provenance and encrypted lifecycle fields required to
406
- translate a hosted result losslessly, so the gateway does not approximate that
407
- protocol. Provider output containing an unexpected hosted web-search call is an
408
- upstream protocol error instead of a fabricated Anthropic result block.
403
+ Hosted Anthropic `web_search` declarations (`web_search`, `web_search_20250305`,
404
+ and `web_search_20260209`, including `allowed_domains`, `user_location`,
405
+ `tool_choice: {"type": "tool", "name": "web_search"}`, and positive integer
406
+ `max_uses`, which is validated and accepted for Anthropic compatibility without
407
+ upstream enforcement) are supported when Classic Responses is active
408
+ (`responses_lite: false`, or `"auto"` on models that use Classic Responses) and
409
+ map to Codex hosted `web_search` with `web_search_call.action.sources`,
410
+ projecting `search`, `open_page`, and `find_in_page` `web_search_call` actions into
411
+ `server_tool_use` and `web_search_tool_result` blocks alongside
412
+ `usage.server_tool_use` (and preserving the raw `web_search_call` items on `/v1/responses`).
413
+ `blocked_domains` and `strict: true` on `web_search`,
414
+ or hosted `web_search` when Responses Lite is active, return HTTP 400. Replayed
415
+ `server_tool_use`, `web_search_tool_result`, text/content `document`, and
416
+ `search_result` blocks in conversation history are rendered into structured
417
+ text context.
409
418
 
410
419
  Completed responses require authoritative final token usage and a real
411
420
  `response.completed` event. Emitted function calls map to `tool_calls` or
@@ -477,7 +486,7 @@ curl http://localhost:18080/v1/messages/count_tokens \
477
486
 
478
487
  ### `POST /v1/messages/compact`
479
488
 
480
- 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.
489
+ 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.
481
490
 
482
491
  ### `POST /v1/images/generations`
483
492
 
@@ -626,7 +635,7 @@ Requests can instead use the Responses-shaped effort/context object:
626
635
  - 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.
627
636
  - Remote compact keeps its existing private Codex `reasoning_effort` field but does not accept public `reasoning.mode` or `reasoning.context`.
628
637
 
629
- 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.
638
+ 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.
630
639
 
631
640
  Anthropic's `JSONOutputFormat` carries a schema but no name. When Claude Code
632
641
  sends that official shape, the proxy follows pinned Codex 0.153.3 and supplies
@@ -635,10 +644,11 @@ or fallback role. An explicit proxy-extension name is preserved only when it is
635
644
  already a valid Responses format name, and is never sanitized or truncated.
636
645
 
637
646
  The pinned official Codex HTTP request has no `stop` field. Omitted OpenAI
638
- `stop`, or explicit OpenAI `stop: null`, is omitted from the private request;
639
- any other OpenAI `stop` value returns HTTP 400. Anthropic `stop_sequences`
640
- follows its typed API contract: omission is allowed, while explicit `null` or
641
- an array value returns HTTP 400 because the private transport cannot apply it.
647
+ `stop`, explicit `stop: null`, and empty `stop: []` are omitted from the private
648
+ request as no-ops; any non-empty OpenAI `stop` value returns HTTP 400. Anthropic
649
+ `stop_sequences` allows omission and empty `stop_sequences: []`, while explicit
650
+ `stop_sequences: null` or any non-empty array returns HTTP 400 because the
651
+ private transport cannot apply stop sequences.
642
652
 
643
653
  The mapping is intentionally transport-aware:
644
654
 
@@ -648,7 +658,7 @@ The mapping is intentionally transport-aware:
648
658
  | `prompt_cache_key` | Forward an explicit value; otherwise use non-empty `client_metadata.session_id` |
649
659
  | Non-null `prompt_cache_options` / breakpoint | HTTP 400; `null` is omitted and there is no private field |
650
660
  | Any supplied `safety_identifier` | HTTP 400; the optional field is non-nullable and OAuth account/thread IDs are not semantic aliases |
651
- | Non-null `stop` / `stop_sequences` | HTTP 400; no private field |
661
+ | Non-empty `stop` / `stop_sequences` (or `stop_sequences: null`) | HTTP 400; empty `[]` (and OpenAI `stop: null`) are omitted |
652
662
  | `previous_response_id` | Resolve locally and replay complete Response history over HTTP |
653
663
  | `service_tier: "fast"` | Send `service_tier: "priority"` |
654
664
  | `service_tier: "default"` | Omit the field |
@@ -859,12 +869,15 @@ CODEX_AS_API_MODEL=gpt-5.6-terra \
859
869
  codex-as-api
860
870
  ```
861
871
 
862
- Claude Code hosted WebSearch is not supported through this gateway, regardless
863
- of Responses Lite mode. Classic Responses can execute an OpenAI hosted search,
864
- but its output lacks the Anthropic provenance and encrypted lifecycle data
865
- needed for a lossless Messages response. WebFetch remains a client-side
866
- auxiliary request and retains the disabled-thinking precedence behavior when
867
- process-level effort is enabled.
872
+ Claude Code hosted `web_search` (`web_search`, `web_search_20250305`, and
873
+ `web_search_20260209`) is supported when Classic Responses is active
874
+ (`responses_lite: false`, or `"auto"` on models whose catalog sets Classic
875
+ Responses), mapping Codex `web_search` calls and `web_search_call.action.sources`
876
+ into Anthropic `server_tool_use` and `web_search_tool_result` blocks alongside
877
+ `usage.server_tool_use`. On Responses Lite models under `responses_lite: "auto"`,
878
+ hosted `web_search` returns HTTP 400 unless `responses_lite: false` is valid
879
+ and supplied. WebFetch remains a client-side auxiliary request and retains the
880
+ disabled-thinking precedence behavior when process-level effort is enabled.
868
881
 
869
882
  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:
870
883
 
@@ -973,9 +986,9 @@ registry setup is still required:
973
986
  After bumping every version and passing the local gate, push the matching tag:
974
987
 
975
988
  ```bash
976
- python scripts/check_package_versions.py --tag v0.10.2
977
- git tag v0.10.2
978
- git push origin v0.10.2
989
+ python scripts/check_package_versions.py --tag v1.0.0
990
+ git tag v1.0.0
991
+ git push origin v1.0.0
979
992
  ```
980
993
 
981
994
  ## Tests
@@ -1,5 +1,15 @@
1
1
  # Release Notes
2
2
 
3
+ ## v1.0.0
4
+
5
+ ### Native OpenAI Responses HTTP endpoints, hosted Anthropic WebSearch bridge, and SDK default compatibility across Python, TypeScript, and Rust
6
+
7
+ - Add native OpenAI Responses HTTP endpoints (`POST /v1/responses` for streaming and non-streaming responses and `POST /v1/responses/compact` for remote compaction) across Python, TypeScript, and Rust (`create_response`/`create_responses_stream`/`compact_responses`, `createResponse`/`createResponsesStream`/`compactResponses`, and `create_native_response`/`stream_prepared_native_responses`/`compact_native_responses` on `ChatGPTOAuthProvider`), including local `previous_response_id` chain replay/commit (including `input: []` continuations), `reasoning.summary` (`auto`, `concise`, `detailed`, `none`), `subagent`/`memgen_request` headers, function and hosted `web_search` tool normalization, and synthesized `output_text`.
8
+ - Bridge hosted Anthropic `web_search` tools (`web_search`, `web_search_20250305`, `web_search_20260209`, including `allowed_domains`, `user_location`, `tool_choice: {"type": "tool", "name": "web_search"}`, and positive integer `max_uses` validated and accepted for Anthropic compatibility without upstream enforcement) on Classic Responses (`responses_lite: false` or `"auto"` when the selected model uses Classic Responses) to Codex hosted `web_search` with `include: ["web_search_call.action.sources"]`, and map upstream `web_search_call` items (`search` including multi-query `action.queries`, `open_page`, and `find_in_page` actions) into Anthropic `server_tool_use` and `web_search_tool_result` blocks plus `usage.server_tool_use` while preserving raw `web_search_call` items on `/v1/responses`.
9
+ - Accept replayed Anthropic `document` (plain-text/content sources), `search_result`, `server_tool_use`, and `web_search_tool_result` content blocks in user, assistant, and `tool_result` message history by rendering structured text representations instead of rejecting multi-turn conversations.
10
+ - Accept standard SDK default/no-op controls that match Codex OAuth behavior: empty `stop: []` and `stop_sequences: []`, `store: false`, `user` metadata on `/v1/chat/completions` and `/v1/images/generations`, `stream_options: {"include_usage": true | false | null}` on streaming endpoints (and `stream_options: null`), Anthropic `metadata` objects with arbitrary string or `null` entries, and `citations: []` or `{"enabled": false}` on Anthropic content blocks.
11
+ - Accept full Anthropic `MessageCreateParams` envelopes on `POST /v1/messages/count_tokens` and `POST /v1/messages/compact` (`temperature`, `top_p`, `top_k`, `stop_sequences`, all valid `tool_choice` variants, and optional `max_tokens` on `/v1/messages/compact`) so callers can pass their existing request payload directly.
12
+
3
13
  ## v0.10.2
4
14
 
5
15
  ### Realtime call & sideband deadlines and cross-runtime parity fixes
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "codex-as-api"
7
- version = "0.10.2"
7
+ version = "1.0.0"
8
8
  description = "Use ChatGPT/Codex OAuth as a local OpenAI-compatible API server."
9
9
  readme = "README.md"
10
10
  license = { text = "Apache-2.0" }
@@ -1,3 +1,3 @@
1
1
  """codex-as-api: Use ChatGPT/Codex OAuth as a local OpenAI-compatible API server."""
2
2
 
3
- __version__ = "0.10.2"
3
+ __version__ = "1.0.0"