codex-as-api 0.6.1__tar.gz → 0.6.3__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.
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/PKG-INFO +35 -7
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/README.md +32 -6
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/RELEASES.md +33 -0
- codex_as_api-0.6.3/THIRD_PARTY_NOTICES.md +34 -0
- codex_as_api-0.6.3/config/o200k_base.tiktoken +199998 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/pyproject.toml +7 -3
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/requirements.txt +2 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/src/codex_as_api/__init__.py +1 -1
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/src/codex_as_api/anthropic_adapter.py +9 -3
- codex_as_api-0.6.3/src/codex_as_api/o200k_tokenizer.py +165 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/src/codex_as_api/server.py +40 -24
- codex_as_api-0.6.3/tests/fixtures/o200k_base_encode_ordinary.json +46 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/tests/test_anthropic_adapter.py +24 -3
- codex_as_api-0.6.3/tests/test_o200k_tokenizer.py +33 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/tests/test_server.py +165 -12
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/.gitignore +0 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/LICENSE +0 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/config/model-capabilities.json +0 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/requirements-server.txt +0 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/src/codex_as_api/auth.py +0 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/src/codex_as_api/codex_config.py +0 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/src/codex_as_api/messages.py +0 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/src/codex_as_api/model_capabilities.py +0 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/src/codex_as_api/protocol.py +0 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/src/codex_as_api/provider.py +0 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/tests/__init__.py +0 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/tests/conftest.py +0 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/tests/test_auth.py +0 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/tests/test_codex_config.py +0 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/tests/test_messages.py +0 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/tests/test_model_capabilities.py +0 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/tests/test_protocol.py +0 -0
- {codex_as_api-0.6.1 → codex_as_api-0.6.3}/tests/test_provider.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: codex-as-api
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.3
|
|
4
4
|
Summary: Use ChatGPT/Codex OAuth as a local OpenAI-compatible API server.
|
|
5
5
|
Project-URL: Homepage, https://github.com/Eunho-J/codex-as-api
|
|
6
6
|
Project-URL: Repository, https://github.com/Eunho-J/codex-as-api
|
|
@@ -18,12 +18,14 @@ Classifier: Programming Language :: Python :: 3.12
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.13
|
|
19
19
|
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
20
|
Requires-Python: >=3.10
|
|
21
|
+
Requires-Dist: regex
|
|
21
22
|
Requires-Dist: tomli>=2; python_version < '3.11'
|
|
22
23
|
Provides-Extra: dev
|
|
23
24
|
Requires-Dist: httpx; extra == 'dev'
|
|
24
25
|
Requires-Dist: mypy; extra == 'dev'
|
|
25
26
|
Requires-Dist: pytest; extra == 'dev'
|
|
26
27
|
Requires-Dist: ruff; extra == 'dev'
|
|
28
|
+
Requires-Dist: types-regex; extra == 'dev'
|
|
27
29
|
Provides-Extra: server
|
|
28
30
|
Requires-Dist: fastapi>=0.100; extra == 'server'
|
|
29
31
|
Requires-Dist: pydantic>=2.0; extra == 'server'
|
|
@@ -310,7 +312,11 @@ curl -N http://localhost:18080/v1/messages \
|
|
|
310
312
|
|
|
311
313
|
### `POST /v1/messages/count_tokens`
|
|
312
314
|
|
|
313
|
-
Anthropic-compatible token counting helper. Codex OAuth does not expose a count-only endpoint equivalent to Anthropic's native API, so this route
|
|
315
|
+
Anthropic-compatible token counting helper. Codex OAuth does not expose a count-only endpoint equivalent to Anthropic's native API, so this route counts text locally and returns context-window metadata for the effective backend model. Normalized model-visible messages, tool calls, tool-result metadata, reasoning, and tool schemas are counted once. Request-envelope and generation-control fields are excluded, and image inputs use a separate fixed estimate so inline base64 data is not counted as text.
|
|
316
|
+
|
|
317
|
+
GPT-5-family text uses a bundled port of official `tiktoken` `o200k_base` `encode_ordinary`: the same Unicode pre-tokenization regex, byte-pair merge algorithm, and merge-rank data are implemented in Python, TypeScript, and Rust. Official `tiktoken` maps `gpt-5` and its `gpt-5-`-prefixed variants to [`o200k_base`](https://github.com/openai/tiktoken/blob/08a5f3b2c987ada4fc5aa1f16c643c203fa8acaa/tiktoken/model.py#L7-L20); this project applies that GPT-5-family encoding to the bundled `gpt-5.*` Codex model IDs. The project does not depend on a `tiktoken` package or download encoding data at runtime. The last upstream synchronization check was **2026-07-14**, against [`tiktoken` 0.13.0 at `08a5f3b`](https://github.com/openai/tiktoken/tree/08a5f3b2c987ada4fc5aa1f16c643c203fa8acaa); the bundled rank file SHA-256 is `446a9538cb6c348e3516120d7c08b09f57c36495e2acfffe59a5bf8b0cfb1a2d`.
|
|
318
|
+
|
|
319
|
+
Official Codex also has a [`ceil(UTF-8 bytes / 4)` truncation helper](https://github.com/openai/codex/blob/393f64565ab46f09d99ca4d9bd973537e72a114b/codex-rs/utils/string/src/truncate.rs#L4-L84), but Codex documents the history estimate using that helper as [a coarse lower bound rather than a tokenizer-accurate count](https://github.com/openai/codex/blob/393f64565ab46f09d99ca4d9bd973537e72a114b/codex-rs/core/src/context_manager/history.rs#L160-L185). This endpoint therefore uses exact `o200k_base` ordinary text tokenization instead. The complete request count remains an estimate because protocol-wrapper overhead and image cost are local constants, but the former byte-as-token and raw-payload double count that could overstate ordinary Claude Code requests by about 8x is removed.
|
|
314
320
|
|
|
315
321
|
```bash
|
|
316
322
|
curl http://localhost:18080/v1/messages/count_tokens \
|
|
@@ -438,7 +444,7 @@ GPT-5.6 requests can instead use the public Responses-shaped object:
|
|
|
438
444
|
- 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.
|
|
439
445
|
- Remote compact keeps its existing private Codex `reasoning_effort` field but does not accept public `reasoning.mode` or `reasoning.context`.
|
|
440
446
|
|
|
441
|
-
Anthropic `thinking` values map as `enabled → high`, `adaptive → medium`, and `disabled → none`. Claude Code's `output_config.effort` takes precedence over
|
|
447
|
+
Anthropic `thinking` values map as `enabled → high`, `adaptive → medium`, and `disabled → none`. Claude Code's `output_config.effort` takes precedence over adaptive or enabled thinking and supports `low`, `medium`, `high`, `xhigh`, and `max`. Call-level `thinking.disabled` takes precedence over ambient `output_config.effort`, so Claude Code WebSearch/WebFetch auxiliary calls use `none` instead of failing the compatibility check with HTTP 400. The supported reasoning context and verbosity extensions are also available on `/v1/messages`, image generation, and inspection requests; Pro and non-null public cache policy/breakpoints or `safety_identifier` fail explicitly on the private Codex provider.
|
|
442
448
|
|
|
443
449
|
The pinned official Codex HTTP request has no `stop` field. Omitted, `null`, and empty stop values are omitted from the private request; any non-empty OpenAI `stop` or Anthropic `stop_sequences` value returns HTTP 400 before the private transport starts.
|
|
444
450
|
|
|
@@ -636,14 +642,18 @@ curl -N http://localhost:18080/v1/chat/completions \
|
|
|
636
642
|
|
|
637
643
|
## Using with Claude Code
|
|
638
644
|
|
|
639
|
-
The `/v1/messages` endpoint implements the Anthropic Messages gateway shape used by Claude Code. Compatibility was validated with Claude Code `2.1.
|
|
645
|
+
The `/v1/messages` endpoint implements the Anthropic Messages gateway shape used by Claude Code. Compatibility was validated with Claude Code `2.1.209`, including streaming, real Codex OAuth chat, request-level GPT model routing, adaptive thinking, `--effort max`, and Fast Mode.
|
|
640
646
|
|
|
641
647
|
Start the proxy first. `CODEX_AS_API_MODEL` is the fallback used when Claude Code sends a built-in Anthropic model name:
|
|
642
648
|
|
|
643
649
|
```bash
|
|
644
|
-
CODEX_AS_API_MODEL=gpt-5.6-terra
|
|
650
|
+
CODEX_AS_API_MODEL=gpt-5.6-terra \
|
|
651
|
+
CODEX_AS_API_RESPONSES_LITE=off \
|
|
652
|
+
codex-as-api
|
|
645
653
|
```
|
|
646
654
|
|
|
655
|
+
`CODEX_AS_API_RESPONSES_LITE=off` is required for Claude Code hosted WebSearch on GPT-5.6. Official Codex Responses Lite uses a client-side standalone `web.run` tool, while this gateway receives Anthropic's hosted `web_search` declaration and has no standalone executor; classic Responses preserves that hosted tool. WebFetch does not use a hosted Responses tool, but still needs the disabled-thinking precedence fix when process-level effort is enabled.
|
|
656
|
+
|
|
647
657
|
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:
|
|
648
658
|
|
|
649
659
|
```bash
|
|
@@ -656,7 +666,7 @@ CLAUDE_CODE_ATTRIBUTION_HEADER=0 \
|
|
|
656
666
|
claude
|
|
657
667
|
```
|
|
658
668
|
|
|
659
|
-
Run `/model` and select **GPT-5.6 Sol**. The custom entry is appended to the built-in rows rather than replacing them. Claude Code `2.1.
|
|
669
|
+
Run `/model` and select **GPT-5.6 Sol**. The custom entry is appended to the built-in rows rather than replacing them. Claude Code `2.1.209` recognizes this GPT model ID without a custom capability declaration: `/effort low|medium|high|xhigh|max`, the picker effort control, and `claude --effort ...` are translated from Claude Code's `output_config.effort` to the Codex reasoning effort. Claude Code Fast Mode's `speed: "fast"` is translated to the Codex `priority` service tier.
|
|
660
670
|
|
|
661
671
|
If managed settings define an `availableModels` allowlist, that list must include the exact `ANTHROPIC_CUSTOM_MODEL_OPTION` value, such as `gpt-5.6-sol`; otherwise Claude Code hides or rejects the custom row.
|
|
662
672
|
|
|
@@ -714,7 +724,7 @@ The provider handles:
|
|
|
714
724
|
## Release & package publishing
|
|
715
725
|
|
|
716
726
|
- Bump versions in `pyproject.toml`, `src/codex_as_api/__init__.py`, `src/codex_as_api/server.py`, `ts/package.json`, `ts/package-lock.json`, `rust/Cargo.toml`, and `rust/Cargo.lock`.
|
|
717
|
-
- Publish a GitHub Release such as `v0.6.
|
|
727
|
+
- Publish a GitHub Release such as `v0.6.3` from the matching commit.
|
|
718
728
|
- The manually-dispatched `Publish npm packages` workflow builds/tests the TypeScript package, runs `npm pack --dry-run`, publishes `codex-as-api` to npmjs when `NPM_TOKEN` is configured, and publishes `@eunho-j/codex-as-api` to GitHub Packages with `GITHUB_TOKEN`.
|
|
719
729
|
|
|
720
730
|
Publishing to npmjs requires an authenticated npm session (`npm login` beforehand; `npm whoami` should succeed). From the repository root, the publish itself is one command:
|
|
@@ -757,6 +767,24 @@ npm test
|
|
|
757
767
|
|
|
758
768
|
## Release Notes
|
|
759
769
|
|
|
770
|
+
### v0.6.3
|
|
771
|
+
|
|
772
|
+
- Accept Claude Code auxiliary requests that combine ambient `output_config.effort` with call-level `thinking.disabled`.
|
|
773
|
+
- Give explicit disabled thinking precedence and send Codex reasoning effort `none` instead of returning HTTP 400.
|
|
774
|
+
- Document and test `CODEX_AS_API_RESPONSES_LITE=off` for Claude Code hosted WebSearch on GPT-5.6; WebFetch needs no Responses Lite override.
|
|
775
|
+
- Preserve fail-loudly validation for invalid effort values and unsupported `output_config` fields.
|
|
776
|
+
- Add Python, TypeScript, and Rust adapter regressions, streamed `/v1/messages` coverage, and a `/count_tokens` regression for the WebSearch/WebFetch request shape.
|
|
777
|
+
|
|
778
|
+
### v0.6.2
|
|
779
|
+
|
|
780
|
+
- Fix `/v1/messages/count_tokens` overcounting that could trigger Claude Code autocompaction on every turn.
|
|
781
|
+
- Count normalized model-visible messages, tool calls, reasoning, tool-result metadata, and tool schemas once; remove the second full raw-request-body addition.
|
|
782
|
+
- Port official `tiktoken` `o200k_base` ordinary encoding into Python, TypeScript, and Rust without adding a `tiktoken` package dependency or runtime rank download.
|
|
783
|
+
- Match the upstream Unicode text split and BPE merge ranks last checked on 2026-07-14 against `tiktoken` 0.13.0 at `08a5f3b`.
|
|
784
|
+
- Keep image input cost separate and count inline base64 images once rather than adding both a fixed image estimate and the base64 request bytes.
|
|
785
|
+
- 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.
|
|
786
|
+
- Validate the release with Claude Code `2.1.209` and real Codex OAuth chat.
|
|
787
|
+
|
|
760
788
|
### v0.6.1
|
|
761
789
|
|
|
762
790
|
- Re-audit official Codex `0.144.4` and `main` at `393f64565ab46f09d99ca4d9bd973537e72a114b`, plus Claude Code `2.1.208`, before publishing.
|
|
@@ -278,7 +278,11 @@ curl -N http://localhost:18080/v1/messages \
|
|
|
278
278
|
|
|
279
279
|
### `POST /v1/messages/count_tokens`
|
|
280
280
|
|
|
281
|
-
Anthropic-compatible token counting helper. Codex OAuth does not expose a count-only endpoint equivalent to Anthropic's native API, so this route
|
|
281
|
+
Anthropic-compatible token counting helper. Codex OAuth does not expose a count-only endpoint equivalent to Anthropic's native API, so this route counts text locally and returns context-window metadata for the effective backend model. Normalized model-visible messages, tool calls, tool-result metadata, reasoning, and tool schemas are counted once. Request-envelope and generation-control fields are excluded, and image inputs use a separate fixed estimate so inline base64 data is not counted as text.
|
|
282
|
+
|
|
283
|
+
GPT-5-family text uses a bundled port of official `tiktoken` `o200k_base` `encode_ordinary`: the same Unicode pre-tokenization regex, byte-pair merge algorithm, and merge-rank data are implemented in Python, TypeScript, and Rust. Official `tiktoken` maps `gpt-5` and its `gpt-5-`-prefixed variants to [`o200k_base`](https://github.com/openai/tiktoken/blob/08a5f3b2c987ada4fc5aa1f16c643c203fa8acaa/tiktoken/model.py#L7-L20); this project applies that GPT-5-family encoding to the bundled `gpt-5.*` Codex model IDs. The project does not depend on a `tiktoken` package or download encoding data at runtime. The last upstream synchronization check was **2026-07-14**, against [`tiktoken` 0.13.0 at `08a5f3b`](https://github.com/openai/tiktoken/tree/08a5f3b2c987ada4fc5aa1f16c643c203fa8acaa); the bundled rank file SHA-256 is `446a9538cb6c348e3516120d7c08b09f57c36495e2acfffe59a5bf8b0cfb1a2d`.
|
|
284
|
+
|
|
285
|
+
Official Codex also has a [`ceil(UTF-8 bytes / 4)` truncation helper](https://github.com/openai/codex/blob/393f64565ab46f09d99ca4d9bd973537e72a114b/codex-rs/utils/string/src/truncate.rs#L4-L84), but Codex documents the history estimate using that helper as [a coarse lower bound rather than a tokenizer-accurate count](https://github.com/openai/codex/blob/393f64565ab46f09d99ca4d9bd973537e72a114b/codex-rs/core/src/context_manager/history.rs#L160-L185). This endpoint therefore uses exact `o200k_base` ordinary text tokenization instead. The complete request count remains an estimate because protocol-wrapper overhead and image cost are local constants, but the former byte-as-token and raw-payload double count that could overstate ordinary Claude Code requests by about 8x is removed.
|
|
282
286
|
|
|
283
287
|
```bash
|
|
284
288
|
curl http://localhost:18080/v1/messages/count_tokens \
|
|
@@ -406,7 +410,7 @@ GPT-5.6 requests can instead use the public Responses-shaped object:
|
|
|
406
410
|
- 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.
|
|
407
411
|
- Remote compact keeps its existing private Codex `reasoning_effort` field but does not accept public `reasoning.mode` or `reasoning.context`.
|
|
408
412
|
|
|
409
|
-
Anthropic `thinking` values map as `enabled → high`, `adaptive → medium`, and `disabled → none`. Claude Code's `output_config.effort` takes precedence over
|
|
413
|
+
Anthropic `thinking` values map as `enabled → high`, `adaptive → medium`, and `disabled → none`. Claude Code's `output_config.effort` takes precedence over adaptive or enabled thinking and supports `low`, `medium`, `high`, `xhigh`, and `max`. Call-level `thinking.disabled` takes precedence over ambient `output_config.effort`, so Claude Code WebSearch/WebFetch auxiliary calls use `none` instead of failing the compatibility check with HTTP 400. The supported reasoning context and verbosity extensions are also available on `/v1/messages`, image generation, and inspection requests; Pro and non-null public cache policy/breakpoints or `safety_identifier` fail explicitly on the private Codex provider.
|
|
410
414
|
|
|
411
415
|
The pinned official Codex HTTP request has no `stop` field. Omitted, `null`, and empty stop values are omitted from the private request; any non-empty OpenAI `stop` or Anthropic `stop_sequences` value returns HTTP 400 before the private transport starts.
|
|
412
416
|
|
|
@@ -604,14 +608,18 @@ curl -N http://localhost:18080/v1/chat/completions \
|
|
|
604
608
|
|
|
605
609
|
## Using with Claude Code
|
|
606
610
|
|
|
607
|
-
The `/v1/messages` endpoint implements the Anthropic Messages gateway shape used by Claude Code. Compatibility was validated with Claude Code `2.1.
|
|
611
|
+
The `/v1/messages` endpoint implements the Anthropic Messages gateway shape used by Claude Code. Compatibility was validated with Claude Code `2.1.209`, including streaming, real Codex OAuth chat, request-level GPT model routing, adaptive thinking, `--effort max`, and Fast Mode.
|
|
608
612
|
|
|
609
613
|
Start the proxy first. `CODEX_AS_API_MODEL` is the fallback used when Claude Code sends a built-in Anthropic model name:
|
|
610
614
|
|
|
611
615
|
```bash
|
|
612
|
-
CODEX_AS_API_MODEL=gpt-5.6-terra
|
|
616
|
+
CODEX_AS_API_MODEL=gpt-5.6-terra \
|
|
617
|
+
CODEX_AS_API_RESPONSES_LITE=off \
|
|
618
|
+
codex-as-api
|
|
613
619
|
```
|
|
614
620
|
|
|
621
|
+
`CODEX_AS_API_RESPONSES_LITE=off` is required for Claude Code hosted WebSearch on GPT-5.6. Official Codex Responses Lite uses a client-side standalone `web.run` tool, while this gateway receives Anthropic's hosted `web_search` declaration and has no standalone executor; classic Responses preserves that hosted tool. WebFetch does not use a hosted Responses tool, but still needs the disabled-thinking precedence fix when process-level effort is enabled.
|
|
622
|
+
|
|
615
623
|
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:
|
|
616
624
|
|
|
617
625
|
```bash
|
|
@@ -624,7 +632,7 @@ CLAUDE_CODE_ATTRIBUTION_HEADER=0 \
|
|
|
624
632
|
claude
|
|
625
633
|
```
|
|
626
634
|
|
|
627
|
-
Run `/model` and select **GPT-5.6 Sol**. The custom entry is appended to the built-in rows rather than replacing them. Claude Code `2.1.
|
|
635
|
+
Run `/model` and select **GPT-5.6 Sol**. The custom entry is appended to the built-in rows rather than replacing them. Claude Code `2.1.209` recognizes this GPT model ID without a custom capability declaration: `/effort low|medium|high|xhigh|max`, the picker effort control, and `claude --effort ...` are translated from Claude Code's `output_config.effort` to the Codex reasoning effort. Claude Code Fast Mode's `speed: "fast"` is translated to the Codex `priority` service tier.
|
|
628
636
|
|
|
629
637
|
If managed settings define an `availableModels` allowlist, that list must include the exact `ANTHROPIC_CUSTOM_MODEL_OPTION` value, such as `gpt-5.6-sol`; otherwise Claude Code hides or rejects the custom row.
|
|
630
638
|
|
|
@@ -682,7 +690,7 @@ The provider handles:
|
|
|
682
690
|
## Release & package publishing
|
|
683
691
|
|
|
684
692
|
- Bump versions in `pyproject.toml`, `src/codex_as_api/__init__.py`, `src/codex_as_api/server.py`, `ts/package.json`, `ts/package-lock.json`, `rust/Cargo.toml`, and `rust/Cargo.lock`.
|
|
685
|
-
- Publish a GitHub Release such as `v0.6.
|
|
693
|
+
- Publish a GitHub Release such as `v0.6.3` from the matching commit.
|
|
686
694
|
- The manually-dispatched `Publish npm packages` workflow builds/tests the TypeScript package, runs `npm pack --dry-run`, publishes `codex-as-api` to npmjs when `NPM_TOKEN` is configured, and publishes `@eunho-j/codex-as-api` to GitHub Packages with `GITHUB_TOKEN`.
|
|
687
695
|
|
|
688
696
|
Publishing to npmjs requires an authenticated npm session (`npm login` beforehand; `npm whoami` should succeed). From the repository root, the publish itself is one command:
|
|
@@ -725,6 +733,24 @@ npm test
|
|
|
725
733
|
|
|
726
734
|
## Release Notes
|
|
727
735
|
|
|
736
|
+
### v0.6.3
|
|
737
|
+
|
|
738
|
+
- Accept Claude Code auxiliary requests that combine ambient `output_config.effort` with call-level `thinking.disabled`.
|
|
739
|
+
- Give explicit disabled thinking precedence and send Codex reasoning effort `none` instead of returning HTTP 400.
|
|
740
|
+
- Document and test `CODEX_AS_API_RESPONSES_LITE=off` for Claude Code hosted WebSearch on GPT-5.6; WebFetch needs no Responses Lite override.
|
|
741
|
+
- Preserve fail-loudly validation for invalid effort values and unsupported `output_config` fields.
|
|
742
|
+
- Add Python, TypeScript, and Rust adapter regressions, streamed `/v1/messages` coverage, and a `/count_tokens` regression for the WebSearch/WebFetch request shape.
|
|
743
|
+
|
|
744
|
+
### v0.6.2
|
|
745
|
+
|
|
746
|
+
- Fix `/v1/messages/count_tokens` overcounting that could trigger Claude Code autocompaction on every turn.
|
|
747
|
+
- Count normalized model-visible messages, tool calls, reasoning, tool-result metadata, and tool schemas once; remove the second full raw-request-body addition.
|
|
748
|
+
- Port official `tiktoken` `o200k_base` ordinary encoding into Python, TypeScript, and Rust without adding a `tiktoken` package dependency or runtime rank download.
|
|
749
|
+
- Match the upstream Unicode text split and BPE merge ranks last checked on 2026-07-14 against `tiktoken` 0.13.0 at `08a5f3b`.
|
|
750
|
+
- Keep image input cost separate and count inline base64 images once rather than adding both a fixed image estimate and the base64 request bytes.
|
|
751
|
+
- 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.
|
|
752
|
+
- Validate the release with Claude Code `2.1.209` and real Codex OAuth chat.
|
|
753
|
+
|
|
728
754
|
### v0.6.1
|
|
729
755
|
|
|
730
756
|
- Re-audit official Codex `0.144.4` and `main` at `393f64565ab46f09d99ca4d9bd973537e72a114b`, plus Claude Code `2.1.208`, before publishing.
|
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# Release Notes
|
|
2
2
|
|
|
3
|
+
## v0.6.3
|
|
4
|
+
|
|
5
|
+
### Claude Code WebSearch/WebFetch auxiliary calls
|
|
6
|
+
|
|
7
|
+
- Fix HTTP 400 responses when a Claude Code session with ambient effort sends a WebSearch/WebFetch auxiliary request containing both `output_config.effort` and call-level `thinking: {"type":"disabled"}`.
|
|
8
|
+
- Give explicit disabled thinking precedence over valid ambient effort and forward Codex reasoning effort `none` across Python, TypeScript, and Rust.
|
|
9
|
+
- Require and document `CODEX_AS_API_RESPONSES_LITE=off` for Claude Code hosted WebSearch on GPT-5.6 because official Responses Lite relies on a standalone `web.run` executor; WebFetch does not require this override.
|
|
10
|
+
- Continue rejecting empty, non-string, or unsupported effort values and unsupported `output_config` fields rather than silently discarding malformed requests.
|
|
11
|
+
|
|
12
|
+
### Validation
|
|
13
|
+
|
|
14
|
+
- Adapter tests cover every valid Claude Code effort value paired with disabled thinking while retaining invalid-value failures.
|
|
15
|
+
- Streamed `/v1/messages` tests across all three runtimes and a local `/count_tokens` test reproduce the Claude Code 2.1.209 request shape and prove provider-backed requests reach the classic Codex wire with reasoning effort `none`.
|
|
16
|
+
- 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.
|
|
17
|
+
|
|
18
|
+
## v0.6.2
|
|
19
|
+
|
|
20
|
+
### Claude Code count_tokens autocompact fix
|
|
21
|
+
|
|
22
|
+
- Fix the Anthropic `/v1/messages/count_tokens` estimator treating every UTF-8 byte as a token and then adding the full raw request body a second time.
|
|
23
|
+
- Port official `tiktoken` `o200k_base` ordinary encoding into Python, TypeScript, and Rust: the same Unicode pre-tokenization regex, byte-pair merge algorithm, and merge ranks now count GPT-5-family text.
|
|
24
|
+
- Count tool calls, tool-result identifiers, reasoning content, and normalized tool schemas once while excluding model IDs, output limits, stream flags, metadata, and other non-model request controls.
|
|
25
|
+
- Keep the existing image estimate separate so URL and inline base64 images are counted once without tokenizing the base64 payload as text.
|
|
26
|
+
- Keep token counting local and OAuth-free. No `tiktoken` package dependency or first-run encoding download is introduced.
|
|
27
|
+
- Record the upstream synchronization point as `tiktoken` 0.13.0 commit `08a5f3b2c987ada4fc5aa1f16c643c203fa8acaa`, checked on 2026-07-14, with the official rank-file SHA-256 verified during release validation.
|
|
28
|
+
|
|
29
|
+
### Validation
|
|
30
|
+
|
|
31
|
+
- A 4,000-byte ASCII message returns `1,012` input tokens in all three implementations instead of roughly `8,000`.
|
|
32
|
+
- Endpoint tests cover UTF-8 text, normalized tools, tool/reasoning history, URL and base64 images, ignored request controls, effective model limits, and zero upstream provider calls.
|
|
33
|
+
- Official `tiktoken` 0.13.0 token IDs match the bundled ports across reference vectors, randomized multilingual text, code, whitespace, contractions, special-token-shaped literals, and long single-piece input.
|
|
34
|
+
- Python, TypeScript, and Rust return identical counts across 204 cross-runtime endpoint cases; Claude Code 2.1.209 real Codex OAuth chat remains compatible.
|
|
35
|
+
|
|
3
36
|
## v0.6.1
|
|
4
37
|
|
|
5
38
|
### Claude Code 2.1.208 compatibility
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Third-Party Notices
|
|
2
|
+
|
|
3
|
+
## OpenAI tiktoken
|
|
4
|
+
|
|
5
|
+
This project includes a port of the `o200k_base` ordinary-encoding logic and
|
|
6
|
+
the corresponding merge-rank data from
|
|
7
|
+
[openai/tiktoken](https://github.com/openai/tiktoken).
|
|
8
|
+
|
|
9
|
+
Synchronized with tiktoken 0.13.0 at commit
|
|
10
|
+
`08a5f3b2c987ada4fc5aa1f16c643c203fa8acaa` on 2026-07-14.
|
|
11
|
+
The bundled rank data has SHA-256
|
|
12
|
+
`446a9538cb6c348e3516120d7c08b09f57c36495e2acfffe59a5bf8b0cfb1a2d`.
|
|
13
|
+
|
|
14
|
+
MIT License
|
|
15
|
+
|
|
16
|
+
Copyright (c) 2022 OpenAI, Shantanu Jain
|
|
17
|
+
|
|
18
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
19
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
20
|
+
in the Software without restriction, including without limitation the rights
|
|
21
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
22
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
23
|
+
furnished to do so, subject to the following conditions:
|
|
24
|
+
|
|
25
|
+
The above copyright notice and this permission notice shall be included in all
|
|
26
|
+
copies or substantial portions of the Software.
|
|
27
|
+
|
|
28
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
29
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
30
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
31
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
32
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
33
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
34
|
+
SOFTWARE.
|