Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

fix(eve): send Fast mode to Codex as service_tier priority (#4324)

e0-gh-vercel-connect[bot]a2453a9c1637
diff --git a/.changeset/chatgpt-fast-service-tier.md b/.changeset/chatgpt-fast-service-tier.md
new file mode 100644
index 000000000..c3196a121
--- /dev/null
+++ b/.changeset/chatgpt-fast-service-tier.md
@@ -0,0 +1,5 @@
+---
+"eve": patch
+---
+
+`chatgpt()` now sends `serviceTier: "fast"` to the Codex backend as `priority`, the value the Codex CLI uses for Fast mode, instead of failing with `400 Unsupported service_tier: fast`.
diff --git a/packages/eve/src/public/models/openai/chatgpt/model.test.ts b/packages/eve/src/public/models/openai/chatgpt/model.test.ts
index 767a21f3f..9f4b225e0 100644
--- a/packages/eve/src/public/models/openai/chatgpt/model.test.ts
+++ b/packages/eve/src/public/models/openai/chatgpt/model.test.ts
@@ -123,6 +123,26 @@ describe("Codex model", () => {
expect(body.include).toContain("reasoning.encrypted_content");
});
+ it("requests Fast mode with the service tier the Codex backend accepts", async () => {
+ const requests: RecordedRequest[] = [];
+ const model = createCodexSubscriptionModel(
+ { model: "gpt-6.1-sol" },
+ {
+ broker: fakeBroker(),
+ fetch: createRecordingFetch(requests),
+ },
+ );
+
+ await model.doGenerate({
+ prompt: [{ role: "user", content: [{ type: "text", text: "hello" }] }],
+ providerOptions: { openai: { serviceTier: "fast" } },
+ });
+
+ // OpenAI documents `fast` as an alias of `priority`, but the Codex backend
+ // rejects `fast` with `400 Unsupported service_tier: fast`.
+ expect(JSON.parse(requests[0]?.body ?? "{}").service_tier).toBe("priority");
+ });
+
it("groups summaries by reasoning item and preserves encrypted-only items", async () => {
const requests: RecordedRequest[] = [];
const model = createCodexSubscriptionModel(
diff --git a/packages/eve/src/public/models/openai/chatgpt/model.ts b/packages/eve/src/public/models/openai/chatgpt/model.ts
index 7201bed0c..8987a86d0 100644
--- a/packages/eve/src/public/models/openai/chatgpt/model.ts
+++ b/packages/eve/src/public/models/openai/chatgpt/model.ts
@@ -68,6 +68,9 @@ function normalizeCodexCallOptions(
...providerOptions,
openai: {
...openaiOptions,
+ // OpenAI documents `fast` as an alias of `priority`, but the Codex
+ // backend rejects `fast`. Codex itself sends `priority` for Fast mode.
+ ...(openaiOptions.serviceTier === "fast" && { serviceTier: "priority" }),
...(instructions !== undefined && { instructions }),
store: false,
},