Skip to content

armgit / qm

Public Imported from GitHub
0

Multiplayer agent harness for work.

Add GPT-6.1 Sol Ultrafast (#2143)

Regan Bell66c3a2911fe5
diff --git a/docs/model-gateway.md b/docs/model-gateway.md
index 7666bc481..b4f6ee467 100644
--- a/docs/model-gateway.md
+++ b/docs/model-gateway.md
@@ -48,26 +48,26 @@ The managed browse runner needs browser-use 0.12.9 with
`ChatOpenAI.default_headers` support. It never requests separate browser model
credentials or falls back to them on account or gateway errors.
-## Astra Ultrafast
+## Ultrafast
-Pi offers `gpt-6-astra-ultrafast` as **GPT-6 Astra · Ultrafast (6× cost)**.
-This is a QM selection identifier: requests use `gpt-6-astra` with
-`service_tier: "ultrafast"` through the Responses API. Standard Astra and its
-Fast switch retain their existing behavior. Ultrafast has its own pricing card,
+Pi offers `gpt-6-astra-ultrafast` and `gpt-6.1-sol-ultrafast`, each labeled
+**Ultrafast (6× cost)**. These are QM selection identifiers: requests use the
+corresponding base model (`gpt-6-astra` or `gpt-6.1-sol`) with
+`service_tier: "ultrafast"` through the Responses API. Standard models and their
+Fast switches retain their existing behavior. Ultrafast has its own pricing card,
including cached input, cache writes, and long-context rates.
-Use an OpenAI API key or explicitly map `gpt-6-astra-ultrafast` to your gateway's
-Astra group in `MODEL_GATEWAY_MODELS`. The gateway must support Responses and
+Use an OpenAI API key or explicitly map the Ultrafast model ID to your gateway's
+corresponding base-model group in `MODEL_GATEWAY_MODELS`. The gateway must support Responses and
forward `service_tier`. The choice is supported in Pi only, and is unavailable
with ChatGPT subscription authentication. It is never selected as the default
merely by enabling Fast.
-OpenAI currently makes Astra Ultrafast broadly available with separate rate
-limits. Sol Ultrafast remains a preview and is not enabled by this choice.
+OpenAI supports Ultrafast for Astra and Sol 6.1 with separate rate limits.
See [Ultrafast availability](https://developers.openai.com/api/docs/guides/ultrafast-mode)
and [pricing](https://developers.openai.com/api/docs/pricing?latest-pricing=ultrafast).
-In the web picker, select Astra and use the Ultrafast switch. The picker shows a
+In the web picker, select Astra or Sol 6.1 and use the Ultrafast switch. The picker shows a
distinct active badge and the 6× cost before enabling it. Fast and Ultrafast are
-mutually exclusive, and both speeds share one Astra preset. The internal model
-ID above preserves routing, authorization, pricing, and saved selections.
+mutually exclusive, and both speeds share one preset per base model. The internal model
+IDs above preserve routing, authorization, pricing, and saved selections.
diff --git a/plugins/web-ui/src/composer-loadout.ts b/plugins/web-ui/src/composer-loadout.ts
index 3577867c7..e766a0775 100644
--- a/plugins/web-ui/src/composer-loadout.ts
+++ b/plugins/web-ui/src/composer-loadout.ts
@@ -15,23 +15,25 @@ export function loadoutModelId(value: string): string {
return separator < 0 ? value : value.slice(separator + 1);
}
-export const ULTRAFAST_MODEL_ID = "gpt-6-astra-ultrafast";
-export const ULTRAFAST_BASE_MODEL_ID = "gpt-6-astra";
+const ULTRAFAST_BASE_MODELS = new Map([
+ ["gpt-6-astra-ultrafast", "gpt-6-astra"],
+ ["gpt-6.1-sol-ultrafast", "gpt-6.1-sol"],
+]);
+
+export function isUltrafastModel(modelId: string): boolean {
+ return ULTRAFAST_BASE_MODELS.has(modelId);
+}
export function presetModelId(value: string): string {
const id = loadoutModelId(value);
- return id === ULTRAFAST_MODEL_ID ? ULTRAFAST_BASE_MODEL_ID : id;
+ return ULTRAFAST_BASE_MODELS.get(id) ?? id;
}
export function ultrafastChoice(options: readonly ModelOption[], selected: ModelOption): ModelOption | undefined {
if (selected.harnessId !== "pi") return undefined;
const id = selected.model.id;
- if (id !== ULTRAFAST_BASE_MODEL_ID && id !== ULTRAFAST_MODEL_ID) return undefined;
- return options.find(
- (option) =>
- option.harnessId === selected.harnessId &&
- option.model.id === (id === ULTRAFAST_MODEL_ID ? ULTRAFAST_BASE_MODEL_ID : ULTRAFAST_MODEL_ID),
- );
+ const target = ULTRAFAST_BASE_MODELS.get(id) ?? [...ULTRAFAST_BASE_MODELS].find(([, base]) => base === id)?.[0];
+ return options.find((option) => option.harnessId === selected.harnessId && option.model.id === target);
}
function uniqueLoadout(entries: readonly LoadoutEntry[]): LoadoutEntry[] {
@@ -179,7 +181,7 @@ export function loadoutActions(
},
toggleFastMode: () => {
const option = selected();
- const target = option?.model.id === ULTRAFAST_MODEL_ID ? ultrafastChoice(options(), option) : undefined;
+ const target = option && isUltrafastModel(option.model.id) ? ultrafastChoice(options(), option) : undefined;
apply({ ...current(), ...(target ? { value: target.value } : {}), fast: !current().fast });
},
};
diff --git a/plugins/web-ui/src/composer.ts b/plugins/web-ui/src/composer.ts
index 10486f2da..9d5f6a055 100644
--- a/plugins/web-ui/src/composer.ts
+++ b/plugins/web-ui/src/composer.ts
@@ -53,7 +53,7 @@ import { tip } from "./tooltip";
import { isPhone } from "./viewport";
import {
LOADOUT_CAP,
- ULTRAFAST_MODEL_ID,
+ isUltrafastModel,
presetModelId,
ultrafastChoice,
loadLoadout,
@@ -1924,7 +1924,7 @@ export function createComposerSurface(ctx: ConvCtx, options: ComposerOptions = {
function toggleFastMode(agent: Agent): void {
const selected = currentModelOption();
if (ctx.chat.hasUnresolvedApproval() || ctx.chat.state.resolvingApprovals.size > 0) return;
- if (selected?.model.id === ULTRAFAST_MODEL_ID) {
+ if (selected && isUltrafastModel(selected.model.id)) {
const target = ultrafastChoice(getModelOptions(scopeKey()), selected);
if (target) applyLoadout({ ...activeLoadoutEntry(selected), value: target.value, fast: true }, agent);
return;
diff --git a/plugins/web-ui/src/model-picker.ts b/plugins/web-ui/src/model-picker.ts
index e63581fec..30d0f7f89 100644
--- a/plugins/web-ui/src/model-picker.ts
+++ b/plugins/web-ui/src/model-picker.ts
@@ -18,8 +18,7 @@ import {
import { modelSupportsFastMode } from "./pi-models.ts";
import {
LOADOUT_CAP,
- ULTRAFAST_MODEL_ID,
- ULTRAFAST_BASE_MODEL_ID,
+ isUltrafastModel,
ultrafastChoice,
effortLevelsForHarness,
compatibleHarnessOptions,
@@ -126,12 +125,13 @@ export function createModelPicker<T>(bindings: ModelPickerBindings<T>) {
}
function modelLabel(option: ModelOption): string {
- return option.model.id === ULTRAFAST_MODEL_ID
+ return isUltrafastModel(option.model.id)
? (catalog
.options()
.find(
- (candidate) => candidate.harnessId === option.harnessId && candidate.model.id === ULTRAFAST_BASE_MODEL_ID,
- )?.label ?? "Astra")
+ (candidate) =>
+ candidate.harnessId === option.harnessId && candidate.model.id === presetModelId(option.value),
+ )?.label ?? option.label)
: option.label;
}
@@ -179,7 +179,7 @@ export function createModelPicker<T>(bindings: ModelPickerBindings<T>) {
<span class="loadout-details">
<span class="loadout-harness">${option.harnessLabel}</span>
<span>${effortText(settings.effort)}</span>
- ${option.model.id === ULTRAFAST_MODEL_ID ? html`<span class="loadout-ultrafast-badge">${icon(Zap, 10)} Ultrafast</span>` : nothing}
+ ${isUltrafastModel(option.model.id) ? html`<span class="loadout-ultrafast-badge">${icon(Zap, 10)} Ultrafast</span>` : nothing}
${settings.fast ? html`<span class="loadout-bolt" aria-label="Fast">${icon(Zap, 10)}</span>` : nothing}
</span>
</span>
@@ -404,7 +404,7 @@ export function createModelPicker<T>(bindings: ModelPickerBindings<T>) {
${modelGlyph(option)}<span class="menu-option-copy"
><span>${modelLabel(option)}</span
><span class="loadout-meta"
- >${option.harnessLabel}${option.model.id === ULTRAFAST_MODEL_ID ? " · Ultrafast · 6× cost" : ""}</span
+ >${option.harnessLabel}${isUltrafastModel(option.model.id) ? " · Ultrafast · 6× cost" : ""}</span
></span
><span class="loadout-add-label" aria-hidden="true">Add</span>
</button>`,
@@ -460,9 +460,9 @@ export function createModelPicker<T>(bindings: ModelPickerBindings<T>) {
if (!selected) return html`<span class="context-model-status">No models available</span>`;
const open = composerState.openMenu === "loadout";
const entries = seededLoadout(selected);
- const ultrafastOn = selected.model.id === ULTRAFAST_MODEL_ID;
+ const ultrafastOn = isUltrafastModel(selected.model.id);
const ultrafastTarget = ultrafastChoice(catalog.options(), selected);
- const modelSupportsFast = catalog.supportsFast(ultrafastOn ? ULTRAFAST_BASE_MODEL_ID : selected.model.id);
+ const modelSupportsFast = catalog.supportsFast(presetModelId(selected.value));
const fastAvailable =
!!choice &&
(!ultrafastOn || !!ultrafastTarget) &&
diff --git a/plugins/web-ui/test/composer-loadout.test.ts b/plugins/web-ui/test/composer-loadout.test.ts
index d9e9fc7ca..475da733c 100644
--- a/plugins/web-ui/test/composer-loadout.test.ts
+++ b/plugins/web-ui/test/composer-loadout.test.ts
@@ -4,6 +4,8 @@ import {
compatibleHarnessOptions,
effortLevelsForHarness,
loadoutModelId,
+ loadoutActions,
+ ultrafastChoice,
modelLoadoutOptions,
parseLoadout,
reconcileLoadout,
@@ -237,12 +239,32 @@ test("native reasoning choices require model and harness metadata and always off
assert.deepEqual(parseLoadout(JSON.stringify(saved)), saved);
});
-test("Astra speed variants share a preset and preserve a saved tier", () => {
- const base = option("pi:gpt-6-astra");
- const ultra = option("pi:gpt-6-astra-ultrafast");
- const saved = entry(ultra.value, "high");
- assert.deepEqual(modelLoadoutOptions([ultra, base], [], "pi"), [base]);
- assert.deepEqual(modelLoadoutOptions([base, ultra], [saved], "pi"), [ultra]);
- assert.deepEqual(modelLoadoutOptions([ultra], [], "pi"), [ultra]);
- assert.deepEqual(upsertLoadout([entry(base.value)], saved), [saved]);
-});
+for (const modelId of ["gpt-6-astra", "gpt-6.1-sol"]) {
+ test(`${modelId} speed variants share a preset and preserve a saved tier`, () => {
+ const base = option(`pi:${modelId}`);
+ const ultra = option(`pi:${modelId}-ultrafast`);
+ const saved = entry(ultra.value, "high");
+ assert.deepEqual(modelLoadoutOptions([ultra, base], [], "pi"), [base]);
+ assert.deepEqual(modelLoadoutOptions([base, ultra], [saved], "pi"), [ultra]);
+ assert.deepEqual(modelLoadoutOptions([ultra], [], "pi"), [ultra]);
+ assert.deepEqual(upsertLoadout([entry(base.value)], saved), [saved]);
+ assert.deepEqual(parseLoadout(JSON.stringify([saved, entry(base.value)])), [saved]);
+ assert.equal(ultrafastChoice([base, ultra], base), ultra);
+ assert.equal(ultrafastChoice([base, ultra], ultra), base);
+ assert.equal(ultrafastChoice([base], base), undefined);
+ assert.equal(ultrafastChoice([base, ultra], option(`claude:${modelId}`)), undefined);
+ let current = saved;
+ const actions = loadoutActions(
+ () => [base, ultra],
+ () => current,
+ (_, next) => {
+ current = next;
+ },
+ (id) => id === modelId,
+ );
+ actions.toggleFastMode();
+ assert.deepEqual(current, entry(base.value, "high", true));
+ actions.toggleFastMode();
+ assert.deepEqual(current, entry(base.value, "high", false));
+ });
+}
diff --git a/plugins/web-ui/test/composer-picker.test.ts b/plugins/web-ui/test/composer-picker.test.ts
index 70c686412..d599a37ed 100644
--- a/plugins/web-ui/test/composer-picker.test.ts
+++ b/plugins/web-ui/test/composer-picker.test.ts
@@ -678,36 +678,41 @@ test("the personal-account picker preserves composer choices and saves context d
await tick();
assert.equal(updates.at(-1)?.effortLevel, "adaptive");
assert.equal(context.contextModelState.config.effective.effortLevel, "adaptive");
- config.modelsByHarness.pi.push("gpt-6-astra", "gpt-6-astra-ultrafast");
- config.modelCatalog!["gpt-6-astra"] = model("gpt-6-astra", "Astra", "openai");
- config.modelCatalog!["gpt-6-astra-ultrafast"] = model("gpt-6-astra-ultrafast", "Astra Ultrafast", "openai");
- config.fastModeModelIds!.push("gpt-6-astra");
- config.effective = { harnessId: "pi", modelId: "gpt-6-astra", effortLevel: "high", fastMode: true };
- ctx.chat.state.threadRef = "web:tester:ultrafast";
- localStorage.removeItem("web-ui:loadout");
- await composer!.refreshRuntimeSelection(null, agent, true);
- await mount();
- button('[aria-label="Ultrafast"]').click();
- assert.match(button(".loadout-button").getAttribute("aria-label")!, /Astra, High effort, Ultrafast/);
- assert.equal(button('button[aria-label="Fast"]').getAttribute("aria-checked"), "false");
- assert.equal(button('[aria-label="Ultrafast"]').getAttribute("aria-checked"), "true");
- assert.deepEqual(
- saved().filter(({ value }) => value.includes("astra")),
- [{ value: "pi:gpt-6-astra-ultrafast", effort: "high", fast: false }],
- );
- ctx.chat.state.threadRef = "web:tester:ultrafast-new-thread";
- await mount();
- assert.match(button(".loadout-button").getAttribute("aria-label")!, /High effort, Ultrafast/);
- button('[data-loadout-section="add"]').click();
- assert.equal(host.querySelector('[aria-label="Add Astra Ultrafast to presets"]'), null);
- button('button[aria-label="Fast"]').click();
- assert.equal(button('button[aria-label="Fast"]').getAttribute("aria-checked"), "true");
- assert.equal(button('[aria-label="Ultrafast"]').getAttribute("aria-checked"), "false");
- button('[aria-label="Ultrafast"]').click();
- button('[aria-label="Ultrafast"]').click();
- assert.equal(button('button[aria-label="Fast"]').getAttribute("aria-checked"), "false");
- assert.equal(button('[aria-label="Ultrafast"]').getAttribute("aria-checked"), "false");
- assert.equal(composer!.state.effortLevel, "high");
+ for (const [modelId, label] of [
+ ["gpt-6-astra", "Astra"],
+ ["gpt-6.1-sol", "Sol 6.1"],
+ ]) {
+ config.modelsByHarness.pi.push(modelId, `${modelId}-ultrafast`);
+ config.modelCatalog![modelId] = model(modelId, label, "openai");
+ config.modelCatalog![`${modelId}-ultrafast`] = model(`${modelId}-ultrafast`, `${label} Ultrafast`, "openai");
+ config.fastModeModelIds!.push(modelId);
+ config.effective = { harnessId: "pi", modelId: modelId, effortLevel: "high", fastMode: true };
+ ctx.chat.state.threadRef = `web:tester:${modelId}-ultrafast`;
+ localStorage.removeItem("web-ui:loadout");
+ await composer!.refreshRuntimeSelection(null, agent, true);
+ await mount();
+ button('[aria-label="Ultrafast"]').click();
+ assert.equal(button(".loadout-button").getAttribute("aria-label"), `Model: ${label}, High effort, Ultrafast`);
+ assert.equal(button('button[aria-label="Fast"]').getAttribute("aria-checked"), "false");
+ assert.equal(button('[aria-label="Ultrafast"]').getAttribute("aria-checked"), "true");
+ assert.deepEqual(
+ saved().filter(({ value }) => value.startsWith(`pi:${modelId}`)),
+ [{ value: `pi:${modelId}-ultrafast`, effort: "high", fast: false }],
+ );
+ ctx.chat.state.threadRef = `web:tester:${modelId}-ultrafast-new-thread`;
+ await mount();
+ assert.match(button(".loadout-button").getAttribute("aria-label")!, /High effort, Ultrafast/);
+ button('[data-loadout-section="add"]').click();
+ assert.equal(host.querySelector(`[aria-label="Add ${label} Ultrafast to presets"]`), null);
+ button('button[aria-label="Fast"]').click();
+ assert.equal(button('button[aria-label="Fast"]').getAttribute("aria-checked"), "true");
+ assert.equal(button('[aria-label="Ultrafast"]').getAttribute("aria-checked"), "false");
+ button('[aria-label="Ultrafast"]').click();
+ button('[aria-label="Ultrafast"]').click();
+ assert.equal(button('button[aria-label="Fast"]').getAttribute("aria-checked"), "false");
+ assert.equal(button('[aria-label="Ultrafast"]').getAttribute("aria-checked"), "false");
+ assert.equal(composer!.state.effortLevel, "high");
+ }
} finally {
resetContext?.();
composer?.dispose();
diff --git a/src/model/pi-models.ts b/src/model/pi-models.ts
index 409eba4dd..671cfb585 100644
--- a/src/model/pi-models.ts
+++ b/src/model/pi-models.ts
@@ -324,6 +324,24 @@ export const MODEL_REGISTRY: readonly ModelEntry[] = [
tiers: [{ inputTokensAbove: 272_000, input: 4, output: 15, cacheRead: 0.2, cacheWrite: 5 }],
},
},
+ {
+ id: "gpt-6.1-sol-ultrafast",
+ buttonLabel: "6.1 Sol Ultrafast",
+ name: "GPT-6.1 Sol · Ultrafast (6× cost)",
+ fastMode: false,
+ webui: true,
+ base: true,
+ request: { model: "gpt-6.1-sol", service_tier: "ultrafast" },
+ clone: {
+ ...GPT_56_CLONE,
+ thinkingLevelMap: { off: null, minimal: null, max: "max" },
+ input: 12,
+ output: 60,
+ cacheRead: 0.6,
+ cacheWrite: 15,
+ tiers: [{ inputTokensAbove: 272_000, input: 24, output: 90, cacheRead: 1.2, cacheWrite: 30 }],
+ },
+ },
{
id: "gpt-6-sol",
buttonLabel: "6 Sol",
diff --git a/test/model-credential-route.test.ts b/test/model-credential-route.test.ts
index b49191983..d387d4ef6 100644
--- a/test/model-credential-route.test.ts
+++ b/test/model-credential-route.test.ts
@@ -75,6 +75,7 @@ test("admin model credentials are encrypted, write-only, live, and removable", a
{ id: "gpt-6-astra", name: "GPT-6 Astra", provider: "openai" },
{ id: "gpt-6-astra-ultrafast", name: "GPT-6 Astra · Ultrafast (6× cost)", provider: "openai" },
{ id: "gpt-6.1-sol", name: "GPT-6.1 Sol", provider: "openai" },
+ { id: "gpt-6.1-sol-ultrafast", name: "GPT-6.1 Sol · Ultrafast (6× cost)", provider: "openai" },
{ id: "gpt-6-sol", name: "GPT-6 Sol", provider: "openai" },
{ id: "gpt-6-luna", name: "GPT-6 Luna", provider: "openai" },
{ id: "openrouter/auto", name: "OpenRouter Auto", provider: "openrouter" },
diff --git a/test/pi-harness-effort-wire.test.ts b/test/pi-harness-effort-wire.test.ts
index 59571a493..3c4089b90 100644
--- a/test/pi-harness-effort-wire.test.ts
+++ b/test/pi-harness-effort-wire.test.ts
@@ -2,13 +2,14 @@ import { test } from "node:test";
import assert from "node:assert/strict";
import { createServer } from "node:http";
import { createPiHarness } from "../src/harness/pi-harness.ts";
-import { getRequiredModel } from "../src/model/pi-models.ts";
+import { getRequiredModel, modelRequestOverrides } from "../src/model/pi-models.ts";
import type { HarnessTurnInput } from "../src/harness/harness.ts";
// Exercise the real AgentSession and SDK serializer, not just the effort setter.
for (const [modelId, upper, allowed, off, minimal] of [
["gpt-5.4", "xhigh", ["none", "low", "medium", "high", "xhigh"], "none", "low"],
["gpt-5", "high", ["minimal", "low", "medium", "high"], "minimal", "minimal"],
+ ["gpt-6.1-sol-ultrafast", "max", ["low", "medium", "high", "xhigh", "max"], "low", "low"],
["gpt-6.1-sol", "max", ["low", "medium", "high", "xhigh", "max"], "low", "low"],
["gpt-5.6-sol", "max", ["none", "low", "medium", "high", "xhigh", "max"], "none", "low"],
["gpt-5.6-terra", "max", ["none", "low", "medium", "high", "xhigh", "max"], "none", "low"],
@@ -121,7 +122,7 @@ for (const [modelId, upper, allowed, off, minimal] of [
url: `http://127.0.0.1:${address.port}`,
apiKey: "test-key",
apiKeyHeader: "api-key",
- models: { [modelId]: modelId === "gpt-6-astra-ultrafast" ? "gpt-6-astra" : modelId },
+ models: { [modelId]: modelRequestOverrides(modelId)?.model ?? modelId },
},
});
t.after(() => harness.turns.close?.());
diff --git a/test/pi-harness-fast-mode.test.ts b/test/pi-harness-fast-mode.test.ts
index 69a4a640a..c592b3ed2 100644
--- a/test/pi-harness-fast-mode.test.ts
+++ b/test/pi-harness-fast-mode.test.ts
@@ -351,6 +351,7 @@ async function runTurn(
models: {
"gpt-6-astra": "openai/gpt-6-astra",
"gpt-6-astra-ultrafast": "openai/gpt-6-astra",
+ "gpt-6.1-sol-ultrafast": "openai/gpt-6.1-sol",
"claude-sonnet-5": "anthropic/claude-sonnet-5",
},
},
@@ -468,21 +469,26 @@ test("a refusal fallback prices each step on its actual model and tier", async (
assertUsd(rows[1]!.usage!.costUsd, 0.15);
});
-for (const gateway of [true, false]) {
- test(`Ultrafast prices a successful turn exactly once through ${gateway ? "gateway" : "direct"}`, async () => {
- const { rows, payloads } = await runTurn(
- `astra-ultrafast-${gateway}`,
- "gpt-6-astra-ultrafast",
- false,
- () => responsesReply("done", ASTRA_WIRE_USAGE, "ultrafast"),
- gateway,
- );
- assert.equal(payloads[0]?.model, gateway ? "openai/gpt-6-astra" : "gpt-6-astra");
- assert.equal(payloads[0]?.service_tier, "ultrafast");
- assert.equal(rows.length, 1);
- assertUsd(rows[0]!.usage!.costUsd, 1.8);
- assert.equal(rows[0]!.model, "gpt-6-astra-ultrafast");
- });
+for (const [baseId, cost] of [
+ ["gpt-6-astra", 1.8],
+ ["gpt-6.1-sol", 0.33],
+] as const) {
+ for (const gateway of [true, false]) {
+ test(`${baseId} Ultrafast prices a successful turn exactly once through ${gateway ? "gateway" : "direct"}`, async () => {
+ const { rows, payloads } = await runTurn(
+ `${baseId}-ultrafast-${gateway}`,
+ `${baseId}-ultrafast`,
+ false,
+ () => responsesReply("done", ASTRA_WIRE_USAGE, "ultrafast"),
+ gateway,
+ );
+ assert.equal(payloads[0]?.model, gateway ? `openai/${baseId}` : baseId);
+ assert.equal(payloads[0]?.service_tier, "ultrafast");
+ assert.equal(rows.length, 1);
+ assertUsd(rows[0]!.usage!.costUsd, cost);
+ assert.equal(rows[0]!.model, `${baseId}-ultrafast`);
+ });
+ }
}
test("a stop_reason refusal retries on the admin-configured fallback runtime", async () => {
diff --git a/test/pi-models.test.ts b/test/pi-models.test.ts
index 1ae84b3eb..12e7bcd51 100644
--- a/test/pi-models.test.ts
+++ b/test/pi-models.test.ts
@@ -114,6 +114,7 @@ test("the curated catalog contains only current model families", () => {
"gpt-6-astra",
"gpt-6-astra-ultrafast",
"gpt-6.1-sol",
+ "gpt-6.1-sol-ultrafast",
"gpt-6-sol",
"gpt-6-luna",
"openrouter/auto",
diff --git a/test/ultrafast.test.ts b/test/ultrafast.test.ts
index 5ba01572f..4cabe12f7 100644
--- a/test/ultrafast.test.ts
+++ b/test/ultrafast.test.ts
@@ -7,83 +7,87 @@ import { buildModelRuntime, piUsageToCallUsage, wantsFastMode } from "../src/har
import { getRequiredModel, modelSupportedByHarness, resolveModel } from "../src/model/pi-models.ts";
import { resolveIndividualAuthRouting } from "../src/core/individual-auth-routing.ts";
-const id = "gpt-6-astra-ultrafast";
+for (const [baseId, shortCost, longCost] of [
+ ["gpt-6-astra", 0.3, 6.35],
+ ["gpt-6.1-sol", 0.055, 1.26],
+] as const) {
+ const id = `${baseId}-ultrafast`;
-test("Ultrafast is an explicit API-only Pi choice with its own full pricing card", () => {
- const model = getRequiredModel(id);
- assert.equal(model.provider, "openai");
- assert.equal(model.api, "openai-responses");
- assert.equal(wantsFastMode(true, id), false);
- assert.equal(modelSupportedByHarness(id, "pi"), true);
- assert.equal(modelSupportedByHarness(id, "claude"), false);
- assert.equal(resolveModel(`codex/${id}`), undefined);
- for (const tokens of [
- { input: 10_000, output: 2_000, cacheRead: 50_000, cacheWrite: 4_000 },
- { input: 300_000, output: 2_000, cacheRead: 50_000, cacheWrite: 4_000 },
- ]) {
- const standardUsage = { ...zeroUsage(), ...tokens };
- const ultrafastUsage = { ...zeroUsage(), ...tokens };
- calculateCost(getRequiredModel("gpt-6-astra"), standardUsage);
- calculateCost(model, ultrafastUsage);
- const standard = piUsageToCallUsage(standardUsage, getRequiredModel("gpt-6-astra"), false)!;
- const ultrafast = piUsageToCallUsage(ultrafastUsage, model, false)!;
- assert.ok(Math.abs(standard.costUsd - (tokens.input === 10_000 ? 0.3 : 6.35)) < 1e-9);
- assert.ok(Math.abs(ultrafast.costUsd - (tokens.input === 10_000 ? 1.8 : 38.1)) < 1e-9);
- assert.ok(Math.abs(ultrafast.costUsd - standard.costUsd * 6) < 1e-9);
- }
- const oauth = { kind: "oauth", oauth: { accessToken: "test" } } as never;
- assert.equal(resolveIndividualAuthRouting(null, oauth, id), null);
- const apiKey = { kind: "apikey", apiKey: "test" } as never;
- assert.equal(resolveIndividualAuthRouting(null, apiKey, id)?.model, id);
- assert.equal(resolveIndividualAuthRouting(apiKey, null, id), null);
-});
-
-for (const gateway of [false, true]) {
- test(`Ultrafast reaches the wire across every runtime call path (${gateway ? "gateway" : "direct"})`, async (t) => {
- const config = gateway
- ? {
- url: "https://gateway.example.test/v1",
- apiKey: "gateway-key",
- apiKeyHeader: "api-key",
- models: { [id]: "router/astra" },
- }
- : undefined;
- const runtime = await buildModelRuntime({ openai: "test-key" }, config);
- const originalFetch = globalThis.fetch;
- t.after(() => {
- globalThis.fetch = originalFetch;
- });
- for (const method of ["stream", "streamSimple", "complete", "completeSimple"] as const) {
- let request: { url: string; body: Record<string, unknown>; headers: Headers } | undefined;
- globalThis.fetch = (async (url: string | URL | Request, init?: RequestInit) => {
- const headers = new Headers(init?.headers);
- const text =
- headers.get("content-encoding") === "zstd"
- ? zstdDecompressSync(init?.body as Uint8Array).toString()
- : String(init?.body);
- request = { url: String(url), body: JSON.parse(text), headers };
- return new Response(JSON.stringify({ error: { message: "offline test" } }), { status: 400 });
- }) as typeof fetch;
- const result = runtime[method](
- getRequiredModel(id),
- { messages: [{ role: "user", content: "hello", timestamp: 0 }] },
- {
- transport: "sse",
- maxRetries: 0,
- onPayload: (payload) => ({
- ...(payload as object),
- service_tier: "priority",
- metadata: { preserved: "yes" },
- }),
- },
- );
- const response = "result" in result ? await result.result() : await result;
- assert.ok(request, `${method}: ${response.errorMessage}`);
- assert.equal(request.body.model, gateway ? "router/astra" : "gpt-6-astra");
- assert.equal(request.body.service_tier, "ultrafast");
- assert.deepEqual(request.body.metadata, { preserved: "yes" });
- assert.equal(response.model, id);
- if (gateway) assert.equal(request.headers.get("api-key"), "gateway-key");
+ test(`${baseId} Ultrafast is an explicit API-only Pi choice with its own full pricing card`, () => {
+ const model = getRequiredModel(id);
+ assert.equal(model.provider, "openai");
+ assert.equal(model.api, "openai-responses");
+ assert.equal(wantsFastMode(true, id), false);
+ assert.equal(modelSupportedByHarness(id, "pi"), true);
+ assert.equal(modelSupportedByHarness(id, "claude"), false);
+ assert.equal(resolveModel(`codex/${id}`), undefined);
+ for (const tokens of [
+ { input: 10_000, output: 2_000, cacheRead: 50_000, cacheWrite: 4_000 },
+ { input: 300_000, output: 2_000, cacheRead: 50_000, cacheWrite: 4_000 },
+ ]) {
+ const standardUsage = { ...zeroUsage(), ...tokens };
+ const ultrafastUsage = { ...zeroUsage(), ...tokens };
+ calculateCost(getRequiredModel(baseId), standardUsage);
+ calculateCost(model, ultrafastUsage);
+ const standard = piUsageToCallUsage(standardUsage, getRequiredModel(baseId), false)!;
+ const ultrafast = piUsageToCallUsage(ultrafastUsage, model, false)!;
+ assert.ok(Math.abs(standard.costUsd - (tokens.input === 10_000 ? shortCost : longCost)) < 1e-9);
+ assert.ok(Math.abs(ultrafast.costUsd - standard.costUsd * 6) < 1e-9);
}
+ const oauth = { kind: "oauth", oauth: { accessToken: "test" } } as never;
+ assert.equal(resolveIndividualAuthRouting(null, oauth, id), null);
+ const apiKey = { kind: "apikey", apiKey: "test" } as never;
+ assert.equal(resolveIndividualAuthRouting(null, apiKey, id)?.model, id);
+ assert.equal(resolveIndividualAuthRouting(apiKey, null, id), null);
});
+
+ for (const gateway of [false, true]) {
+ test(`${baseId} Ultrafast reaches the wire across every runtime call path (${gateway ? "gateway" : "direct"})`, async (t) => {
+ const config = gateway
+ ? {
+ url: "https://gateway.example.test/v1",
+ apiKey: "gateway-key",
+ apiKeyHeader: "api-key",
+ models: { [id]: `router/${baseId}` },
+ }
+ : undefined;
+ const runtime = await buildModelRuntime({ openai: "test-key" }, config);
+ const originalFetch = globalThis.fetch;
+ t.after(() => {
+ globalThis.fetch = originalFetch;
+ });
+ for (const method of ["stream", "streamSimple", "complete", "completeSimple"] as const) {
+ let request: { url: string; body: Record<string, unknown>; headers: Headers } | undefined;
+ globalThis.fetch = (async (url: string | URL | Request, init?: RequestInit) => {
+ const headers = new Headers(init?.headers);
+ const text =
+ headers.get("content-encoding") === "zstd"
+ ? zstdDecompressSync(init?.body as Uint8Array).toString()
+ : String(init?.body);
+ request = { url: String(url), body: JSON.parse(text), headers };
+ return new Response(JSON.stringify({ error: { message: "offline test" } }), { status: 400 });
+ }) as typeof fetch;
+ const result = runtime[method](
+ getRequiredModel(id),
+ { messages: [{ role: "user", content: "hello", timestamp: 0 }] },
+ {
+ transport: "sse",
+ maxRetries: 0,
+ onPayload: (payload) => ({
+ ...(payload as object),
+ service_tier: "priority",
+ metadata: { preserved: "yes" },
+ }),
+ },
+ );
+ const response = "result" in result ? await result.result() : await result;
+ assert.ok(request, `${method}: ${response.errorMessage}`);
+ assert.equal(request.body.model, gateway ? `router/${baseId}` : baseId);
+ assert.equal(request.body.service_tier, "ultrafast");
+ assert.deepEqual(request.body.metadata, { preserved: "yes" });
+ assert.equal(response.model, id);
+ if (gateway) assert.equal(request.headers.get("api-key"), "gateway-key");
+ }
+ });
+ }
}