Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
478 changes: 269 additions & 209 deletions Cargo.lock

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ license = "Apache-2.0"
rust-version = "1.95"

[dependencies]
codex-context-fragments = { git = "https://github.com/openai/codex.git", rev = "a956835d020762cb2b570053af06f643a11c0ecc" }
codex-websocket-client = { git = "https://github.com/openai/codex.git", rev = "a956835d020762cb2b570053af06f643a11c0ecc" }
codex-context-fragments = { git = "https://github.com/openai/codex.git", rev = "c1382380de69521303b416720a52f42d51af6248" }
codex-websocket-client = { git = "https://github.com/openai/codex.git", rev = "c1382380de69521303b416720a52f42d51af6248" }
tokio-tungstenite = "0.28"
zstd = "0.13"
anyhow = "1"
Expand All @@ -27,22 +27,22 @@ toml = "0.9.5"
tracing = "0.1"
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
uuid = { version = "1", features = ["v4", "v5"] }
codex-api = { git = "https://github.com/openai/codex.git", rev = "a956835d020762cb2b570053af06f643a11c0ecc" }
codex-client = { git = "https://github.com/openai/codex.git", rev = "a956835d020762cb2b570053af06f643a11c0ecc" }
codex-http-client = { git = "https://github.com/openai/codex.git", rev = "a956835d020762cb2b570053af06f643a11c0ecc" }
codex-login = { git = "https://github.com/openai/codex.git", rev = "a956835d020762cb2b570053af06f643a11c0ecc" }
codex-model-provider = { git = "https://github.com/openai/codex.git", rev = "a956835d020762cb2b570053af06f643a11c0ecc" }
codex-model-provider-info = { git = "https://github.com/openai/codex.git", rev = "a956835d020762cb2b570053af06f643a11c0ecc" }
codex-models-manager = { git = "https://github.com/openai/codex.git", rev = "a956835d020762cb2b570053af06f643a11c0ecc" }
codex-protocol = { git = "https://github.com/openai/codex.git", rev = "a956835d020762cb2b570053af06f643a11c0ecc" }
codex-config = { git = "https://github.com/openai/codex.git", rev = "a956835d020762cb2b570053af06f643a11c0ecc" }
codex-api = { git = "https://github.com/openai/codex.git", rev = "c1382380de69521303b416720a52f42d51af6248" }
codex-client = { git = "https://github.com/openai/codex.git", rev = "c1382380de69521303b416720a52f42d51af6248" }
codex-http-client = { git = "https://github.com/openai/codex.git", rev = "c1382380de69521303b416720a52f42d51af6248" }
codex-login = { git = "https://github.com/openai/codex.git", rev = "c1382380de69521303b416720a52f42d51af6248" }
codex-model-provider = { git = "https://github.com/openai/codex.git", rev = "c1382380de69521303b416720a52f42d51af6248" }
codex-model-provider-info = { git = "https://github.com/openai/codex.git", rev = "c1382380de69521303b416720a52f42d51af6248" }
codex-models-manager = { git = "https://github.com/openai/codex.git", rev = "c1382380de69521303b416720a52f42d51af6248" }
codex-protocol = { git = "https://github.com/openai/codex.git", rev = "c1382380de69521303b416720a52f42d51af6248" }
codex-config = { git = "https://github.com/openai/codex.git", rev = "c1382380de69521303b416720a52f42d51af6248" }


codex-features = { git = "https://github.com/openai/codex.git", rev = "a956835d020762cb2b570053af06f643a11c0ecc" }
codex-features = { git = "https://github.com/openai/codex.git", rev = "c1382380de69521303b416720a52f42d51af6248" }

codex-tools = { git = "https://github.com/openai/codex.git", rev = "a956835d020762cb2b570053af06f643a11c0ecc" }
codex-tools = { git = "https://github.com/openai/codex.git", rev = "c1382380de69521303b416720a52f42d51af6248" }

codex-exec-server = { git = "https://github.com/openai/codex.git", rev = "a956835d020762cb2b570053af06f643a11c0ecc" }
codex-exec-server = { git = "https://github.com/openai/codex.git", rev = "c1382380de69521303b416720a52f42d51af6248" }

[dev-dependencies]
reqwest = { version = "0.12", features = ["json", "stream", "multipart"] }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
A gateway that uses your ChatGPT subscription through the Codex Rust libraries.

Supports Responses, streaming, WebSocket, images, files, search and Realtime.
Built on Codex **0.160.0** and Rust **1.95.0**.
Built on Codex **0.162.0** and Rust **1.95.0**.

The gateway loads your account's model catalog at startup, including
`gpt-6-sol` and `gpt-6-luna` when available. Restart to refresh the catalog;
Expand Down
24 changes: 12 additions & 12 deletions baseline/codex-release.lock.json
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
{
"repository": "https://github.com/openai/codex.git",
"release": "0.160.0",
"tag": "rust-v0.160.0",
"tag_object": "79b1b666f2e8551f8abbbca34957227f67f3f553",
"commit": "a956835d020762cb2b570053af06f643a11c0ecc",
"published_at": "2026-10-01T20:19:13Z",
"release_url": "https://github.com/openai/codex/releases/tag/rust-v0.160.0",
"release": "0.162.0",
"tag": "rust-v0.162.0",
"tag_object": "1f3f93473394b620b35580859b7e6864f7a9f948",
"commit": "c1382380de69521303b416720a52f42d51af6248",
"published_at": "2026-10-08T18:55:59Z",
"release_url": "https://github.com/openai/codex/releases/tag/rust-v0.162.0",
"prerelease": false,
"companions": [
{
"asset": "bwrap-x86_64-unknown-linux-musl.tar.gz",
"url": "https://github.com/openai/codex/releases/download/rust-v0.160.0/bwrap-x86_64-unknown-linux-musl.tar.gz",
"sha256": "1844535ea16d5454a6b5ee5df541c068ea8ddf1028ad3520255b16e05de3183d",
"url": "https://github.com/openai/codex/releases/download/rust-v0.162.0/bwrap-x86_64-unknown-linux-musl.tar.gz",
"sha256": "b1df5504149571dea01ed01005a480d9aeb990ae53938dc1546663428b7b169f",
"executable": "codex-resources/bwrap"
},
{
"asset": "codex-code-mode-host-x86_64-unknown-linux-musl.tar.gz",
"url": "https://github.com/openai/codex/releases/download/rust-v0.160.0/codex-code-mode-host-x86_64-unknown-linux-musl.tar.gz",
"sha256": "ac6cd6288f0e39f46a33eba1cfd37711651f14f33dbc73d6a1b82eb45e038cac",
"url": "https://github.com/openai/codex/releases/download/rust-v0.162.0/codex-code-mode-host-x86_64-unknown-linux-musl.tar.gz",
"sha256": "dee8bf3df637c68e1495b928d643b76d4ad44f94e4f0ed79fe8482fa79e23d97",
"executable": "codex-code-mode-host"
}
],
"binary": {
"asset": "codex-x86_64-unknown-linux-musl.tar.gz",
"url": "https://github.com/openai/codex/releases/download/rust-v0.160.0/codex-x86_64-unknown-linux-musl.tar.gz",
"sha256": "306865417d4ee7a927785852910a527f41e1e159add390ac5ae3accb67d44a13"
"url": "https://github.com/openai/codex/releases/download/rust-v0.162.0/codex-x86_64-unknown-linux-musl.tar.gz",
"sha256": "8daf67f6261161aa5939d8d42a516032d760406216779d7ce6040f242140ff73"
}
}
4 changes: 2 additions & 2 deletions docs/codex-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@

| Query parameter | Type / behavior |
| --- | --- |
| `client_version` | Optional string; defaults to `0.160.0`. At most 128 ASCII letters, digits, `.`, `-`, `_`, `+`. |
| `client_version` | Optional string; defaults to `0.162.0`. At most 128 ASCII letters, digits, `.`, `-`, `_`, `+`. |

Example: `/backend-api/codex/models?client_version=0.160.0`.
Example: `/backend-api/codex/models?client_version=0.162.0`.

The original `ModelsClient` fetches the catalog using the gateway's subscription. The complete upstream JSON is preserved, including fields outside the pinned model schema:

Expand Down
4 changes: 2 additions & 2 deletions docs/codex-responses.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
Send the native request built by Codex. `model` must be a string and `stream` must be `true`:

```json
{"model":"gpt-5.5","instructions":"You are a coding assistant.","input":[{"role":"user","content":[{"type":"input_text","text":"Hello"}]}],"tools":[],"tool_choice":"auto","store":false,"stream":true}
{"model":"gpt-5.5","input":[{"role":"developer","content":[{"type":"input_text","text":"You are a coding assistant."}]},{"role":"user","content":[{"type":"input_text","text":"Hello"}]}],"tools":[],"tool_choice":"auto","store":false,"stream":true}
```

Native JSON, tool namespaces, future fields and Responses Lite payloads are preserved. The gateway does not apply public catalog validation to `model`; the upstream validates native requests. `Content-Encoding` accepts `identity` or `zstd`.
Expand All @@ -19,6 +19,6 @@ Codex session/routing metadata is forwarded, including `session-id`, `thread-id`

Always SSE with native event payloads, including unknown event fields. Unlike `/v1/responses`, this endpoint does not assemble or rewrite terminal `response.output`. The original Codex parser validates the stream; interrupted streams never become synthetic success responses.

Codex 0.160.0 performs remote compaction through native Responses using a `compaction_trigger` input item. The separate [compact facade](responses-compact.md) is for applications that want a single JSON result.
Codex 0.162.0 performs remote compaction through native Responses using a `compaction_trigger` input item. The separate [compact facade](responses-compact.md) is for applications that want a single JSON result.

Local shell, filesystem, custom and MCP tools still execute in the calling Codex. Native [images](images-generations.md) and [standalone search](search.md) use their corresponding gateway routes.
2 changes: 1 addition & 1 deletion docs/common.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,4 @@ Gateway errors use this shape; `message` describes the failure:

Upstream HTTP failures preserve their status and body, which may be non-JSON, plus headers such as `Retry-After`; transparent native routes preserve all end-to-end headers. Once SSE or WebSocket starts, failures are conveyed as events or connection closure; HTTP 200 alone does not mean generation succeeded.

Public adapters reject unsupported parameters instead of silently pretending to implement them. Native Responses preserves unknown protocol fields; native images/search use the pinned Codex types. Compatibility targets Codex **0.160.0**, not every OpenAI service or future Codex release.
Public adapters reject unsupported parameters instead of silently pretending to implement them. Native Responses preserves unknown protocol fields; native images/search use the pinned Codex types. Compatibility targets Codex **0.162.0**, not every OpenAI service or future Codex release.
2 changes: 1 addition & 1 deletion docs/health.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
`GET /healthz` · No authentication, body or query parameters required.

```json
{"status":"ok","codex_release":"0.160.0","codex_revision":"687a119f0fcaace47e1f1abcc77cec6c813fd6da"}
{"status":"ok","codex_release":"0.162.0","codex_revision":"687a119f0fcaace47e1f1abcc77cec6c813fd6da"}
```

HTTP 200 confirms the gateway is running and reports its pinned source version. It does not call the upstream or guarantee current subscription validity, quota or model availability.
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[Common rules](common.md) · [Native routing and credentials](native.md) · [Pinned inventory](../baseline/api-inventory.json) · [Official counterpart mapping](../baseline/openai-api-counterparts.json)

Each page describes one logical endpoint and its aliases. The inventory is a snapshot of first-party routes audited against Codex 0.155.1; the gateway now uses 0.160.0. Transparent forwarding does not establish entitlement or full public API compatibility. `field?` means optional/nullable in the inventory's client revision; server-owned and additional fields are preserved.
Each page describes one logical endpoint and its aliases. The inventory is a snapshot of first-party routes audited against Codex 0.155.1; the gateway now uses 0.162.0. Transparent forwarding does not establish entitlement or full public API compatibility. `field?` means optional/nullable in the inventory's client revision; server-owned and additional fields are preserved.

## Public adapters

Expand Down
2 changes: 1 addition & 1 deletion docs/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ No request body or required query parameters. When `client_version` is present (
{"object":"list","data":[{"id":"gpt-5.5","object":"model","created":0,"owned_by":"openai"}]}
```

At startup, the gateway fetches the current account catalog using Codex 0.160.0. Public Responses (HTTP and WebSocket) and compaction validate model names and capabilities against this snapshot, so newly available models such as `gpt-6-sol` and `gpt-6-luna` do not require a new bundled catalog. Restart the gateway to refresh it.
At startup, the gateway fetches the current account catalog using Codex 0.162.0. Public Responses (HTTP and WebSocket) and compaction validate model names and capabilities against this snapshot, so newly available models such as `gpt-6-sol` and `gpt-6-luna` do not require a new bundled catalog. Restart the gateway to refresh it.

If fetching fails, times out (after at most 30 seconds), or returns an empty/invalid catalog, startup logs a warning and falls back to the pinned Codex bundled catalog. Models absent from that fallback remain unavailable through public Responses. This is not a complete image-model or OpenAI Platform model directory; image endpoints default to `gpt-image-2` separately.

Expand Down
2 changes: 1 addition & 1 deletion docs/native.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Native routing

The gateway uses Codex **0.160.0** and retains the native route inventory audited against **0.155.1**. Source anchors in the endpoint pages refer to that inventory snapshot; upgrading the client does not establish continued upstream availability for every server-owned route. See the [endpoint index](index.md), [source inventory](../baseline/api-inventory.json) and [official API comparison](../baseline/openai-api-counterparts.json). These routes relay server-owned contracts; account entitlement and upstream validation still apply.
The gateway uses Codex **0.162.0** and retains the native route inventory audited against **0.155.1**. Source anchors in the endpoint pages refer to that inventory snapshot; upgrading the client does not establish continued upstream availability for every server-owned route. See the [endpoint index](index.md), [source inventory](../baseline/api-inventory.json) and [official API comparison](../baseline/openai-api-counterparts.json). These routes relay server-owned contracts; account entitlement and upstream validation still apply.

| Gateway prefix | Upstream prefix |
| --- | --- |
Expand Down
2 changes: 1 addition & 1 deletion docs/realtime.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@

**Response:** full-duplex Realtime JSON text and native binary/control frames. Event payloads, transcription events, errors and close behavior are relayed; no Responses event conversion is applied. The configured timeout is an idle timeout.

The upstream is `https://api.openai.com/v1/realtime`. Use `X-Codex-Gateway-Authorization` for the gateway key and `Authorization` for an API key when starting a direct session. Codex 0.160.0 requires an API key for its direct Realtime connection. Its existing WebRTC-call sideband explicitly supports the ChatGPT authorization used to create that call; ordinary gateway Bearer mode reuses the gateway subscription for this case. Subscription access to arbitrary new public Realtime sessions is not established by the source.
The upstream is `https://api.openai.com/v1/realtime`. Use `X-Codex-Gateway-Authorization` for the gateway key and `Authorization` for an API key when starting a direct session. Codex 0.162.0 requires an API key for its direct Realtime connection. Its existing WebRTC-call sideband explicitly supports the ChatGPT authorization used to create that call; ordinary gateway Bearer mode reuses the gateway subscription for this case. Subscription access to arbitrary new public Realtime sessions is not established by the source.

[Pinned sideband authorization](https://github.com/openai/codex/blob/be2951ea34f0d295ed0becf97079f92fa5f6950e/codex-rs/core/src/client.rs#L412) · [Pinned direct-session gate](https://github.com/openai/codex/blob/be2951ea34f0d295ed0becf97079f92fa5f6950e/codex-rs/core/src/realtime_conversation.rs#L1773) · [Official WebSocket guide](https://developers.openai.com/api/docs/guides/voice-websockets?api=realtime)
2 changes: 1 addition & 1 deletion docs/responses.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Known reasoning efforts are `none`, `minimal`, `low`, `medium`, `high`, `xhigh`,

`reasoning.generate_summary` is accepted as a deprecated alias of `summary`. Explicit `reasoning.context` values are preserved; `auto` and `current_turn` select regular Responses because Lite requires `all_turns`. Omitted/null context retains the Lite default of `all_turns` when the request uses Lite (and is omitted for regular requests). Requests containing hosted `web_search` always use regular Responses, where the hosted tool can execute. See the [SDK compatibility suite and parameter audit](sdk-compatibility.md).

Message inputs accept `role` (`user`, `assistant`, `system`, `developer`) and string or Codex content arrays. Public `system` messages are forwarded as `developer` messages because Codex rejects the `system` input role. Their content and position are preserved, and explicit top-level `instructions` remain unchanged. Text and image content, reasoning, function/custom calls and their outputs, web-search calls and Codex compaction items are supported. Functions/custom tools run in the caller, which submits their outputs in the next request.
Message inputs accept `role` (`user`, `assistant`, `system`, `developer`) and string or Codex content arrays. Public `system` messages are forwarded as `developer` messages because Codex rejects the `system` input role. Their content and position are preserved, and explicit top-level `instructions` retain their content and are prepended as a classified developer message, matching Codex 0.162.0 (for both standard and lite requests). Text and image content, reasoning, function/custom calls and their outputs, web-search calls and Codex compaction items are supported. Functions/custom tools run in the caller, which submits their outputs in the next request.

HTTP continuation requires complete input history. `previous_response_id`, `background`, temperature/sampling controls, output-token limits and other unlisted top-level fields are not implemented here.

Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ pub mod transfers;
pub mod transport;
pub mod websocket;

pub const CODEX_RELEASE: &str = "0.160.0";
pub const CODEX_REV: &str = "a956835d020762cb2b570053af06f643a11c0ecc";
pub const CODEX_RELEASE: &str = "0.162.0";
pub const CODEX_REV: &str = "c1382380de69521303b416720a52f42d51af6248";
6 changes: 1 addition & 5 deletions src/lite_instructions.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copied from Codex 0.160.0 core/context/base_instructions.rs; Apache-2.0.
// Copied from Codex 0.162.0 core/context/base_instructions.rs; Apache-2.0.
use codex_context_fragments::ContextualUserFragment;
use codex_protocol::models::ContentItemKind;

Expand All @@ -14,10 +14,6 @@ impl ContextualUserFragment for BaseInstructionsFragment {
"developer"
}

fn requires_separate_message(&self) -> bool {
true
}

fn markers(&self) -> (&'static str, &'static str) {
Self::type_markers()
}
Expand Down
Loading
Loading