


























@@ -5,7 +5,7 @@ import { describe, expect, it } from "vitest";
55import { buildOpenAIProvider } from "./openai-provider.js";
6677const OPENAI_API_KEY = process.env.OPENAI_API_KEY ?? "";
8-const DEFAULT_LIVE_MODEL_IDS = ["gpt-5.5", "gpt-5.4-mini", "gpt-5.4-nano"] as const;
8+const DEFAULT_LIVE_MODEL_IDS = ["chat-latest", "gpt-5.5", "gpt-5.4-mini", "gpt-5.4-nano"] as const;
99const liveEnabled = OPENAI_API_KEY.trim().length > 0 && process.env.OPENCLAW_LIVE_TEST === "1";
1010const describeLive = liveEnabled ? describe : describe.skip;
1111@@ -16,6 +16,8 @@ type LiveModelCase = {
1616cost: { input: number; output: number; cacheRead: number; cacheWrite: number };
1717contextWindow: number;
1818maxTokens: number;
19+reasoning: boolean;
20+textVerbosity: "low" | "medium";
1921};
20222123function findOpenAIModel(modelId: string): Model<Api> | null {
@@ -24,6 +26,17 @@ function findOpenAIModel(modelId: string): Model<Api> | null {
24262527function resolveLiveModelCase(modelId: string): LiveModelCase {
2628switch (modelId) {
29+case "chat-latest":
30+return {
31+ modelId,
32+templateId: "gpt-5.5",
33+templateName: "GPT-5.5",
34+cost: { input: 5, output: 30, cacheRead: 0.5, cacheWrite: 0 },
35+contextWindow: 400_000,
36+maxTokens: 128_000,
37+reasoning: false,
38+textVerbosity: "medium",
39+};
2740case "gpt-5.5":
2841return {
2942 modelId,
@@ -32,6 +45,8 @@ function resolveLiveModelCase(modelId: string): LiveModelCase {
3245cost: { input: 5, output: 30, cacheRead: 0, cacheWrite: 0 },
3346contextWindow: 1_000_000,
3447maxTokens: 128_000,
48+reasoning: true,
49+textVerbosity: "low",
3550};
3651case "gpt-5.5-pro":
3752return {
@@ -41,6 +56,8 @@ function resolveLiveModelCase(modelId: string): LiveModelCase {
4156cost: { input: 30, output: 180, cacheRead: 0, cacheWrite: 0 },
4257contextWindow: 1_000_000,
4358maxTokens: 128_000,
59+reasoning: true,
60+textVerbosity: "low",
4461};
4562case "gpt-5.4":
4663return {
@@ -50,6 +67,8 @@ function resolveLiveModelCase(modelId: string): LiveModelCase {
5067cost: { input: 1.75, output: 14, cacheRead: 0.175, cacheWrite: 0 },
5168contextWindow: 400_000,
5269maxTokens: 128_000,
70+reasoning: true,
71+textVerbosity: "low",
5372};
5473case "gpt-5.4-pro":
5574return {
@@ -59,6 +78,8 @@ function resolveLiveModelCase(modelId: string): LiveModelCase {
5978cost: { input: 21, output: 168, cacheRead: 0, cacheWrite: 0 },
6079contextWindow: 400_000,
6180maxTokens: 128_000,
81+reasoning: true,
82+textVerbosity: "low",
6283};
6384case "gpt-5.4-mini":
6485return {
@@ -68,6 +89,8 @@ function resolveLiveModelCase(modelId: string): LiveModelCase {
6889cost: { input: 0.25, output: 2, cacheRead: 0.025, cacheWrite: 0 },
6990contextWindow: 400_000,
7091maxTokens: 128_000,
92+reasoning: true,
93+textVerbosity: "low",
7194};
7295case "gpt-5.4-nano":
7396return {
@@ -77,6 +100,8 @@ function resolveLiveModelCase(modelId: string): LiveModelCase {
77100cost: { input: 0.05, output: 0.4, cacheRead: 0.005, cacheWrite: 0 },
78101contextWindow: 400_000,
79102maxTokens: 128_000,
103+reasoning: true,
104+textVerbosity: "low",
80105};
81106default:
82107throw new Error(`Unsupported live OpenAI model: ${modelId}`);
@@ -113,7 +138,7 @@ describeLive("buildOpenAIProvider live", () => {
113138provider: "openai",
114139api: "openai-completions",
115140baseUrl: "https://api.openai.com/v1",
116-reasoning: true,
141+reasoning: liveCase.reasoning,
117142input: ["text", "image"],
118143cost: liveCase.cost,
119144contextWindow: liveCase.contextWindow,
@@ -146,6 +171,7 @@ describeLive("buildOpenAIProvider live", () => {
146171id: liveCase.modelId,
147172api: "openai-responses",
148173baseUrl: "https://api.openai.com/v1",
174+reasoning: liveCase.reasoning,
149175});
150176151177const client = new OpenAI({
@@ -158,8 +184,8 @@ describeLive("buildOpenAIProvider live", () => {
158184instructions: "Return exactly OK and no other text.",
159185input: "Return exactly OK.",
160186max_output_tokens: 64,
161-reasoning: { effort: "none" },
162-text: { verbosity: "low" },
187+...(liveCase.reasoning ? { reasoning: { effort: "none" as const } } : {}),
188+text: { verbosity: liveCase.textVerbosity },
163189});
164190165191expect(response.output_text.trim()).toMatch(/^OK[.!]?$/);
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。