@aexol/spectral 0.3.0 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/pi-bridge.js +24 -3
- package/package.json +1 -1
package/dist/server/pi-bridge.js
CHANGED
|
@@ -124,6 +124,12 @@ const MODEL_PRICING = [
|
|
|
124
124
|
{ prefix: "claude-3-sonnet", input: 3, output: 15, cacheWrite: 3.75, cacheRead: 0.30 },
|
|
125
125
|
{ prefix: "claude-3-haiku", input: 0.25, output: 1.25, cacheWrite: 1.25, cacheRead: 0.025 },
|
|
126
126
|
// OpenAI models
|
|
127
|
+
{ prefix: "gpt-5.5", input: 1.75, output: 14, cacheWrite: 14, cacheRead: 0.35 },
|
|
128
|
+
{ prefix: "gpt-5.4", input: 1.75, output: 14, cacheWrite: 14, cacheRead: 0.35 },
|
|
129
|
+
{ prefix: "gpt-5.3", input: 1.75, output: 14, cacheWrite: 14, cacheRead: 0.35 },
|
|
130
|
+
{ prefix: "gpt-5.2", input: 1.75, output: 14, cacheWrite: 14, cacheRead: 0.35 },
|
|
131
|
+
{ prefix: "gpt-5.1", input: 2, output: 8, cacheWrite: 8, cacheRead: 0.50 },
|
|
132
|
+
{ prefix: "gpt-5", input: 1.25, output: 10, cacheWrite: 10, cacheRead: 0.25 },
|
|
127
133
|
{ prefix: "gpt-4.1", input: 2, output: 8, cacheWrite: 8, cacheRead: 0.50 },
|
|
128
134
|
{ prefix: "gpt-4o", input: 2.50, output: 10, cacheWrite: 10, cacheRead: 1.25 },
|
|
129
135
|
{ prefix: "gpt-4-turbo", input: 10, output: 30, cacheWrite: 0, cacheRead: 0 },
|
|
@@ -158,6 +164,21 @@ function lookupPricing(modelId) {
|
|
|
158
164
|
}
|
|
159
165
|
return null;
|
|
160
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* Model prefixes known to support reasoning/thinking.
|
|
169
|
+
* Mirrors pi-ai's supportsXhigh() + additional models.
|
|
170
|
+
*/
|
|
171
|
+
const REASONING_SUPPORT_PREFIXES = [
|
|
172
|
+
"gpt-5.2", "gpt-5.3", "gpt-5.4", "gpt-5.5",
|
|
173
|
+
"claude-opus-4",
|
|
174
|
+
"o3", "o4",
|
|
175
|
+
"deepseek-r1",
|
|
176
|
+
"gemini-2.5",
|
|
177
|
+
];
|
|
178
|
+
/** Check if a modelId prefix indicates reasoning/thinking support. */
|
|
179
|
+
function supportsReasoning(modelId) {
|
|
180
|
+
return REASONING_SUPPORT_PREFIXES.some((p) => modelId.startsWith(p));
|
|
181
|
+
}
|
|
161
182
|
/**
|
|
162
183
|
* Parse the newline-delimited JSON of wire events persisted alongside an
|
|
163
184
|
* assistant message and extract all tool_call / tool_result events.
|
|
@@ -497,7 +518,7 @@ export class PiBridge {
|
|
|
497
518
|
// at our synthetic proxy provider so auth resolves to the machine JWT.
|
|
498
519
|
provider: SPECTRAL_PROXY_ANTHROPIC,
|
|
499
520
|
baseUrl,
|
|
500
|
-
reasoning:
|
|
521
|
+
reasoning: supportsReasoning(m.modelId),
|
|
501
522
|
input: ["text", "image"],
|
|
502
523
|
// Real pricing so pi can compute accurate token costs.
|
|
503
524
|
cost: pricing
|
|
@@ -527,7 +548,7 @@ export class PiBridge {
|
|
|
527
548
|
// breaking auth lookup against our synthetic proxy provider.
|
|
528
549
|
provider: SPECTRAL_PROXY_OPENAI,
|
|
529
550
|
baseUrl,
|
|
530
|
-
reasoning:
|
|
551
|
+
reasoning: supportsReasoning(m.modelId),
|
|
531
552
|
input: ["text", "image"],
|
|
532
553
|
// Real pricing so pi can compute accurate token costs.
|
|
533
554
|
cost: pricing
|
|
@@ -558,7 +579,7 @@ export class PiBridge {
|
|
|
558
579
|
api: "openai-completions",
|
|
559
580
|
provider: SPECTRAL_PROXY_USER_MODEL,
|
|
560
581
|
baseUrl,
|
|
561
|
-
reasoning:
|
|
582
|
+
reasoning: supportsReasoning(m.modelId),
|
|
562
583
|
input: ["text", "image"],
|
|
563
584
|
cost: pricing
|
|
564
585
|
? { input: pricing.input, output: pricing.output, cacheRead: pricing.cacheRead, cacheWrite: pricing.cacheWrite }
|