From 36df5a6e84021ceef5afe2e858ef6165775e5e05 Mon Sep 17 00:00:00 2001 From: BlocksOrg Date: Mon, 27 Oct 2025 02:24:04 +0000 Subject: [PATCH] Remove /v1 from all API endpoints MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated all endpoint references to remove /v1 prefix: - Updated billing/redeem_credits endpoint in login scripts - Updated mock test endpoints from /v1/responses to /responses - Updated API endpoint comments and documentation - Updated model provider info comments This aligns with the new API structure without version prefixes. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- codex-cli/src/utils/get-api-key.tsx | 2 +- codex-rs/core/src/model_provider_info.rs | 4 ++-- codex-rs/core/src/models.rs | 2 +- codex-rs/core/tests/live_cli.rs | 2 +- codex-rs/core/tests/previous_response_id.rs | 4 ++-- codex-rs/core/tests/stream_no_completed.rs | 2 +- codex-rs/login/src/login_with_chatgpt.py | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/codex-cli/src/utils/get-api-key.tsx b/codex-cli/src/utils/get-api-key.tsx index 520f92efdd3..d9a6040e47d 100644 --- a/codex-cli/src/utils/get-api-key.tsx +++ b/codex-cli/src/utils/get-api-key.tsx @@ -221,7 +221,7 @@ async function maybeRedeemCredits( ? "https://api.openai.com" : "https://api.openai.org"; - const redeemRes = await fetch(`${apiHost}/v1/billing/redeem_credits`, { + const redeemRes = await fetch(`${apiHost}/billing/redeem_credits`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ id_token: currentIdToken }), diff --git a/codex-rs/core/src/model_provider_info.rs b/codex-rs/core/src/model_provider_info.rs index 44b406c9854..23cf2c109e5 100644 --- a/codex-rs/core/src/model_provider_info.rs +++ b/codex-rs/core/src/model_provider_info.rs @@ -22,10 +22,10 @@ use crate::openai_api_key::get_openai_api_key; #[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)] #[serde(rename_all = "lowercase")] pub enum WireApi { - /// The experimental “Responses” API exposed by OpenAI at `/v1/responses`. + /// The experimental "Responses" API exposed by OpenAI at `/responses`. #[default] Responses, - /// Regular Chat Completions compatible with `/v1/chat/completions`. + /// Regular Chat Completions compatible with `/chat/completions`. Chat, } diff --git a/codex-rs/core/src/models.rs b/codex-rs/core/src/models.rs index ccc550e8e52..d38cffb1d9a 100644 --- a/codex-rs/core/src/models.rs +++ b/codex-rs/core/src/models.rs @@ -62,7 +62,7 @@ pub enum ResponseItem { call_id: String, }, // NOTE: The input schema for `function_call_output` objects that clients send to the - // OpenAI /v1/responses endpoint is NOT the same shape as the objects the server returns on the + // OpenAI /responses endpoint is NOT the same shape as the objects the server returns on the // SSE stream. When *sending* we must wrap the string output inside an object that includes a // required `success` boolean. The upstream TypeScript CLI does this implicitly. To ensure we // serialize exactly the expected shape we introduce a dedicated payload struct and flatten it diff --git a/codex-rs/core/tests/live_cli.rs b/codex-rs/core/tests/live_cli.rs index d79e242c4d8..a46c1306ff4 100644 --- a/codex-rs/core/tests/live_cli.rs +++ b/codex-rs/core/tests/live_cli.rs @@ -1,6 +1,6 @@ #![expect(clippy::expect_used)] -//! Optional smoke tests that hit the real OpenAI /v1/responses endpoint. They are `#[ignore]` by +//! Optional smoke tests that hit the real OpenAI /responses endpoint. They are `#[ignore]` by //! default so CI stays deterministic and free. Developers can run them locally with //! `cargo test --test live_cli -- --ignored` provided they set a valid `OPENAI_API_KEY`. diff --git a/codex-rs/core/tests/previous_response_id.rs b/codex-rs/core/tests/previous_response_id.rs index b9c89f350ef..6f93901129d 100644 --- a/codex-rs/core/tests/previous_response_id.rs +++ b/codex-rs/core/tests/previous_response_id.rs @@ -71,7 +71,7 @@ async fn keeps_previous_response_id_between_tasks() { .set_body_raw(sse_completed("resp1"), "text/event-stream"); Mock::given(method("POST")) - .and(path("/v1/responses")) + .and(path("/responses")) .and(NoPrevId) .respond_with(first) .expect(1) @@ -84,7 +84,7 @@ async fn keeps_previous_response_id_between_tasks() { .set_body_raw(sse_completed("resp2"), "text/event-stream"); Mock::given(method("POST")) - .and(path("/v1/responses")) + .and(path("/responses")) .and(HasPrevId) .respond_with(second) .expect(1) diff --git a/codex-rs/core/tests/stream_no_completed.rs b/codex-rs/core/tests/stream_no_completed.rs index 02c03681d0f..ca7d70d8281 100644 --- a/codex-rs/core/tests/stream_no_completed.rs +++ b/codex-rs/core/tests/stream_no_completed.rs @@ -67,7 +67,7 @@ async fn retries_on_early_close() { } Mock::given(method("POST")) - .and(path("/v1/responses")) + .and(path("/responses")) .respond_with(SeqResponder {}) .expect(2) .mount(&server) diff --git a/codex-rs/login/src/login_with_chatgpt.py b/codex-rs/login/src/login_with_chatgpt.py index dc058f64244..2addb729051 100644 --- a/codex-rs/login/src/login_with_chatgpt.py +++ b/codex-rs/login/src/login_with_chatgpt.py @@ -561,7 +561,7 @@ def maybe_redeem_credits( try: redeem_payload = json.dumps({"id_token": id_token}).encode() req = urllib.request.Request( - url=f"{api_host}/v1/billing/redeem_credits", + url=f"{api_host}/billing/redeem_credits", data=redeem_payload, method="POST", headers={"Content-Type": "application/json"},