@abhishek944/pi-classifier 0.5.1 → 0.6.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ - Added `opencode-go-api` using OpenCode Go's official System One endpoint, Pi's `opencode-go` stored API-key credential or `OPENCODE_API_KEY`, and the documented `jev-1.14`, `gemini-decision-1`, and `gpt-6-luna-decision` models. The route exposes text/JSON bool, choice and score decisions with bundled public prices and the documented GPT-6-Luna long-context multiplier.
5
6
  - Added verified built-in routes for Vercel AI Gateway, Google Gemini Decision 1, Inception Mercury Decide, Parallel Decisions, OpenRouter alpha Decisions and Extractions, LiteLLM extraction, and self-hosted llama.cpp/vLLM/Strands/Laya/Nimble System One runtimes with explicit capability tiers.
6
7
  - Added Microsoft Foundry Decision-1.1 image assets and Entra bearer auth, TypeSafe long context, Liquid JSON `path` metadata, Clairic image rotation, OpenAI native `input_json`/boolean choices/score descriptions/image detail/prompt-cache controls, and per-route question/media limits.
7
8
  - Generalized `classify_extract` to direct Cloudflare Clairic, OpenRouter alpha Extractions and LiteLLM `/v1/extraction`; added an Inception `extract` question primitive and Parallel request-wide citations.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # pi-classifier
2
2
 
3
- A Pi extension for typed, probabilistic decisions across Microsoft Foundry Decision-1.1, OpenAI Decisions, Perplexity Decisions, Sarvam Prism, TypeSafe Jev, Liquid d1.2, Cloudflare Clef/Clef Flash/Clef-omni, Google Gemini Decision 1, Inception Mercury Decide, Parallel Decisions, OpenRouter alpha Decisions, Vercel AI Gateway, self-hosted System One runtimes, and Clairic-shaped extraction. It also exposes Perplexity text-span location and web grounding, grounded Parallel citations, and typed reads from supported models.
3
+ A Pi extension for typed, probabilistic decisions across Microsoft Foundry Decision-1.1, OpenAI Decisions, Perplexity Decisions, Sarvam Prism, TypeSafe Jev, Liquid d1.2, Cloudflare Clef/Clef Flash/Clef-omni, Google Gemini Decision 1, OpenCode Go decisions, Inception Mercury Decide, Parallel Decisions, OpenRouter alpha Decisions, Vercel AI Gateway, self-hosted System One runtimes, and Clairic-shaped extraction. It also exposes Perplexity text-span location and web grounding, grounded Parallel citations, and typed reads from supported models.
4
4
 
5
5
  One configured default, optional selective fallback, and explicit model comparisons. No automatic retries or permission auto-approval.
6
6
 
@@ -77,7 +77,7 @@ Credential priority is:
77
77
 
78
78
  OAuth credentials are never used as API keys, never refreshed by this extension, and never changed. You can remain logged in to Codex for chat while using `openai-api` for classifier calls. If the stored `openai` slot contains OAuth rather than an API key, the extension skips it and uses your configured or environment API key.
79
79
 
80
- Pi keeps one credential per provider ID, not both OAuth and an API key in the same slot. An OpenAI key stored under `openai` is distinct from Codex login under `openai-codex`.
80
+ Pi keeps one credential per provider ID, not both OAuth and an API key in the same slot. An OpenAI key stored under `openai` is distinct from Codex login under `openai-codex`. OpenCode Go reuses Pi's stored `opencode-go` API-key credential. The separate `opencode` slot, OAuth logins, and Codex login are not used; without a stored Go credential or `providers["opencode-go"].apiKey`, set `OPENCODE_API_KEY`.
81
81
 
82
82
  Stored API-key values support literal strings and `$NAME`/`${NAME}` references, including provider-scoped stored environment values before process environment values. A missing reference leaves the stored key unresolved rather than sending a partial key. Shell-command credentials are intentionally not executed. Credentials and headers are never printed by status/list. This stored-key support is an addition in the classifier package: the current image-gen API route reads configuration/environment keys, while its subscription route resolves Pi's OAuth login.
83
83
 
@@ -89,6 +89,7 @@ Stored API-key values support literal strings and `$NAME`/`${NAME}` references,
89
89
  | `openai-api` | `openai` | `gpt-6-luna` | `OPENAI_API_KEY` |
90
90
  | `vercel-api` | `vercel` | `openai/gpt-6-luna-decisions`, `typesafe-ai/jev` | `VERCEL_AI_GATEWAY_API_KEY` |
91
91
  | `gemini-api` | `gemini` | `gemini-decision-1` | `GEMINI_API_KEY` |
92
+ | `opencode-go-api` | `opencode-go` | `jev-1.14`, `gemini-decision-1`, `gpt-6-luna-decision` | Pi's `opencode-go` stored API key or `OPENCODE_API_KEY` |
92
93
  | `inception-api` | `inception` | `mercury-decide` | `INCEPTION_API_KEY` |
93
94
  | `parallel-api` | `parallel` | `parallel-decisions` | `PARALLEL_API_KEY` |
94
95
  | `perplexity-api` | `perplexity` | v1.3, Flash v1.3, v1.2, latest aliases, legacy v1/v1.1 IDs | `PERPLEXITY_API_KEY` |
@@ -115,6 +116,7 @@ New text model IDs on built-in routes can be selected without a package release.
115
116
  | OpenAI Decisions and Vercel AI Gateway | bool, choice, score | text, native JSON, local/hosted images | gateway cost captured when returned | Boolean choice values, score descriptions, image detail and prompt-cache controls are supported on the OpenAI wire.
116
117
  | OpenRouter alpha Decisions | bool, choice, score; box only on TypeSafe Jev 1.14/latest | per-adapter image/audio/video/file placement; remote URLs only for documented models | `usage.cost` reported as `providerCost` | Alpha contract; media placement and limits are registry-driven.
117
118
  | Google Gemini Decisions | bool, choice, score | text, images, audio, video | no bundled rate | Direct `/v1beta/decisions` with `x-goog-api-key`; question media is rejected upstream.
119
+ | OpenCode Go decisions | bool (`noul`), choice, score | text/JSON only | public USD list rates | Uses Go's System One endpoint; OpenAI Decisions is also available upstream but is not exposed here. No media or JSON-schema `response_format` claim.
118
120
  | Inception Mercury Decide | bool, choice, score, `extract` | text and inline images; no media with extract | no bundled rate | The Mercury API is documented to shut down after 2026-12-28.
119
121
  | Parallel Decisions | bool, choice, score | text/JSON only | no bundled rate | Web grounding is intrinsic; request-wide citations are returned as `citations`.
120
122
  | Microsoft Foundry | bool, choice, score; no box | text/JSON and PNG/JPEG assets | account pricing | Entra bearer or API key; no published numeric image/context limits.
@@ -126,7 +128,7 @@ New text model IDs on built-in routes can be selected without a package release.
126
128
  | Local System One runtimes | bool, choice, score | runtime/model specific | `unknown_pricing` | llama.cpp, vLLM, Strands, Laya and Nimble use explicit capability tiers; Transformers/mlx-vlm are in-process runtimes and have no HTTP endpoint in this package.
127
129
  | Extraction | Clairic fields | text, images, PDFs on direct Clairic; images on gateways | gateway cost captured when returned | Direct Cloudflare, OpenRouter alpha and LiteLLM extraction routes share validation but use separate transports.
128
130
 
129
- Unresolved by design: no live entitlement, codec, hardware-fit or invoice check was run; OpenRouter alpha shapes and dynamic model catalogs can change; Cloudflare's direct Workers AI REST gateway-header requirement is internally inconsistent in official docs; and Microsoft does not publish a complete answer schema or numeric image limits. These are reported as limits, not filled with guessed support.
131
+ Unresolved by design: no live entitlement, codec, hardware-fit, OpenCode Go response, or invoice check was run; OpenRouter alpha shapes and dynamic model catalogs can change; Cloudflare's direct Workers AI REST gateway-header requirement is internally inconsistent in official docs; and Microsoft does not publish a complete answer schema or numeric image limits. These are reported as limits, not filled with guessed support.
130
132
 
131
133
  ## Use
132
134
 
@@ -272,6 +274,9 @@ This example uses 1,000 Jev input tokens. Amounts are not rounded to cents; doin
272
274
  | --- | ---: | ---: |
273
275
  | OpenAI Decisions `gpt-6-luna` | 0.10 | 0 |
274
276
  | TypeSafe `jev-1.13.0`, `jev-1.14.0`, `jev-latest`, `jev-preview` | 0.042 | 0 |
277
+ | OpenCode Go `jev-1.14` | 0.042 | 0 |
278
+ | OpenCode Go `gemini-decision-1` | 0.10 | 0 |
279
+ | OpenCode Go `gpt-6-luna-decision` (≤ 272K input tokens) | 0.10 | 0 |
275
280
  | Perplexity `pplx-decider-v1.3`, `pplx-decider-latest`, `pplx-decider-v1.2`, `pplx-decider-v1.1-27b`, `pplx-decider-v1-27b` | 0.02 | 0 |
276
281
  | Perplexity `pplx-decider-flash-v1.3`, `pplx-decider-flash-latest`, `pplx-decider-flash-v1.2` | 0.01 | 0 |
277
282
  | Cloudflare `@cf/cloudflare/clef` | 0.24 | 0 |
@@ -282,11 +287,11 @@ This example uses 1,000 Jev input tokens. Amounts are not rounded to cents; doin
282
287
  | Liquid `d1.2-ultra` | 0.042 | 0 |
283
288
  | Cloudflare `typesafe/jev` | 0.042 | 0 |
284
289
 
285
- Sources: [OpenAI Decisions pricing](https://developers.openai.com/api/docs/guides/decisions#pricing-and-availability), [OpenAI rates](https://developers.openai.com/api/docs/pricing), [TypeSafe models](https://docs.typesafe.ai/models), [Perplexity Decisions](https://docs.perplexity.ai/docs/decisions/quickstart#pricing), [Perplexity changelog](https://docs.perplexity.ai/docs/resources/changelog), [Clef](https://developers.cloudflare.com/workers-ai/models/clef/), [Clef Flash](https://developers.cloudflare.com/workers-ai/models/clef-flash/), [Clef-omni](https://developers.cloudflare.com/workers-ai/models/clef-omni/), [Clairic](https://developers.cloudflare.com/workers-ai/models/clairic/), [Cloudflare Jev](https://developers.cloudflare.com/ai/models/typesafe/jev/), [Liquid d1.2](https://docs.liquid.ai/lfm/models/d1). Aliases can move and public prices can change; explicit overrides take precedence. Perplexity's `pplx-decider-latest` now selects v1.3 and `pplx-decider-flash-latest` selects Flash v1.3; revalidate thresholds tuned on earlier models. Its [model names](https://docs.perplexity.ai/docs/decisions/quickstart#model-names) documentation maps the older v1/v1.1 IDs in the discovery catalog to v1.2 and bills them at its rate. New text model IDs may already be selected through settings, but this cost feature does not change image capability declarations.
290
+ Sources: [OpenAI Decisions pricing](https://developers.openai.com/api/docs/guides/decisions#pricing-and-availability), [OpenAI rates](https://developers.openai.com/api/docs/pricing), [OpenCode Go](https://opencode.ai/docs/console/go/), [TypeSafe models](https://docs.typesafe.ai/models), [Perplexity Decisions](https://docs.perplexity.ai/docs/decisions/quickstart#pricing), [Perplexity changelog](https://docs.perplexity.ai/docs/resources/changelog), [Clef](https://developers.cloudflare.com/workers-ai/models/clef/), [Clef Flash](https://developers.cloudflare.com/workers-ai/models/clef-flash/), [Clef-omni](https://developers.cloudflare.com/workers-ai/models/clef-omni/), [Clairic](https://developers.cloudflare.com/workers-ai/models/clairic/), [Cloudflare Jev](https://developers.cloudflare.com/ai/models/typesafe/jev/), [Liquid d1.2](https://docs.liquid.ai/lfm/models/d1). Aliases can move and public prices can change; explicit overrides take precedence. Perplexity's `pplx-decider-latest` now selects v1.3 and `pplx-decider-flash-latest` selects Flash v1.3; revalidate thresholds tuned on earlier models. Its [model names](https://docs.perplexity.ai/docs/decisions/quickstart#model-names) documentation maps the older v1/v1.1 IDs in the discovery catalog to v1.2 and bills them at its rate. New text model IDs may already be selected through settings, but this cost feature does not change image capability declarations.
286
291
 
287
292
  Sarvam publishes Prism's rate in INR (₹4 per million input tokens, zero output tokens). This package reports USD, so `sarvam-api` has no bundled rate and returns `cost.reason: "unknown_pricing"` until you set `providers.sarvam.pricing` with a verified USD rate. No exchange rate is invented.
288
293
 
289
- When reported, cache reads and writes are exposed as `usage.cachedInputTokens` and `usage.cacheWriteTokens`. They are **included** in input tokens, not additional tokens. Input cost is `(ordinary input × input rate + cache reads × cached-input rate + cache writes × cache-write rate) / 1,000,000`; output cost uses its separate rate. OpenAI's bundled cached-input rate is $0.01/M and default 30-minute write rate is $0.125/M, with all input rates doubled above 272,000 input tokens. Cloudflare Jev's bundled cached-input rate is zero. Unexpected 12-hour writes are unavailable rather than priced as 30-minute writes.
294
+ When reported, cache reads and writes are exposed as `usage.cachedInputTokens` and `usage.cacheWriteTokens`. They are **included** in input tokens, not additional tokens. Input cost is `(ordinary input × input rate + cache reads × cached-input rate + cache writes × cache-write rate) / 1,000,000`; output cost uses its separate rate. OpenAI's bundled cached-input rate is $0.01/M and default 30-minute write rate is $0.125/M, with all input rates doubled above 272,000 input tokens. OpenCode Go's `gpt-6-luna-decision` uses the same cached rates and the same documented doubling above 272,000 input tokens. Cloudflare Jev's bundled cached-input rate is zero. Unexpected 12-hour writes are unavailable rather than priced as 30-minute writes.
290
295
 
291
296
  If pricing or usable token counts are missing, `cost` is `{ "status": "unavailable", "currency": "USD", "reason": "unknown_pricing" }` (or `missing_usage`, `invalid_usage`, `missing_cache_pricing`, `calculation_overflow`). No numeric amounts are returned in that case. Zero means a calculated zero, never an unknown charge. Failed or cancelled calls may still be billable but do not have reliable cost results; a fallback success reports only the successful request, not a total for prior attempts. Comparison callers must not treat a sum of available estimates as complete if any entries failed or have unavailable costs.
292
297
 
@@ -327,6 +332,7 @@ The artificial **64-choice cap has been removed** from both runtime validation a
327
332
  | Cloudflare Clef Flash | 2–255 | [Official input schema](https://developers.cloudflare.com/workers-ai/models/clef-flash/schema-input.json) |
328
333
  | Cloudflare Clef-omni | 2–255 | [Official input schema](https://developers.cloudflare.com/workers-ai/models/clef-omni/schema-input.json) |
329
334
  | Liquid `d1.2`, `d1.2-ultra` | 2–255 | [Liquid Decisions reference](https://docs.liquid.ai/api/reference/decision-models/make-decisions) |
335
+ | OpenCode Go decision models | Not independently verified for this route | Automatic batching stays off unless `providers["opencode-go"].maxChoices` is set from a verified endpoint contract |
330
336
  | Cloudflare-hosted Jev | Not independently verified | Do not assume direct-TypeSafe limits apply to every gateway |
331
337
  | Microsoft Decision-1 | Not specified in the fetched guide | [Foundry guide](https://learn.microsoft.com/en-us/azure/foundry/foundry-models/how-to/use-foundry-models-microsoft-decision) |
332
338
  | OpenRouter-hosted Jev / custom routes | Endpoint-dependent; not verified | Requires the selected gateway/model's contract |
@@ -486,6 +492,24 @@ The credential is `providers.sarvam.apiKey`, Pi's stored `sarvam` API-key creden
486
492
 
487
493
  Provider errors are reported with the standard safe HTTP error plus a whitelisted Sarvam code, field path and request ID when present. Untrusted field paths and request IDs that contain the active API key are omitted, including response-header request IDs before falling back to the body; raw provider text and credentials are never printed. Selecting a custom `baseUrl` does not inherit the bundled USD pricing; set `providers.sarvam.pricing` explicitly if you need a cost estimate. Clef requires Provisioned Throughput access; an unavailable entitlement returns a safe HTTP error rather than a silent fallback.
488
494
 
495
+ ## OpenCode Go decisions
496
+
497
+ Select `opencode-go-api` explicitly:
498
+
499
+ ```json
500
+ {
501
+ "pi-classifier": {
502
+ "default": { "provider": "opencode-go-api", "model": "jev-1.14" }
503
+ }
504
+ }
505
+ ```
506
+
507
+ The built-in route posts to `https://opencode.ai/inference/go/systemone/v1/systemone` with `Authorization: Bearer`. It reuses Pi's stored `opencode-go` API-key credential, `providers["opencode-go"].apiKey`, or `OPENCODE_API_KEY`, in that order. It does not use the separate `opencode` credential slot or any OAuth session. A 401 means the key is invalid; a 403 means the key is not entitled to Go or the selected model.
508
+
509
+ The three documented decision models expose text/JSON `bool` (wire `noul`), `choice`, and `score` answers with the same probability validation used by other System One routes. OpenCode also documents an OpenAI Decisions endpoint and chat-style media parts for some models, but this route does not claim those mappings, JSON-schema `response_format`, box answers, or an automatic fallback. Changing `baseUrl` points the built-in route elsewhere and drops its bundled public prices.
510
+
511
+ Prices are OpenCode's USD list rates, not invoice amounts. Go usage within a subscription allowance is reported separately by OpenCode and is not inferred from the estimate. Decision and embedding requests do not require the `x-opencode-session` header, so none is sent.
512
+
489
513
  ## Fallback and explicit comparison
490
514
 
491
515
  `classify` uses the default first. It tries configured `fallback` entries in order **only** after a missing API key or an explicit HTTP **401, 404, or 429**. Each resolved endpoint/model is selected at most once in the fallback chain; explicitly configured choice batching can make multiple requests on that selected route. When fallback is exercised, `attemptedRoutes` identifies the routes considered, including missing-key failures.
package/dist/config.js CHANGED
@@ -146,6 +146,19 @@ export const BUILT_INS = [
146
146
  { id: "gemini-decision-1", input: ["text", "image", "audio", "video"] },
147
147
  ],
148
148
  },
149
+ {
150
+ id: "opencode-go",
151
+ route: "opencode-go-api",
152
+ api: "system-one",
153
+ baseUrl: "https://opencode.ai/inference/go/systemone/v1",
154
+ credentialProvider: "opencode-go",
155
+ envVar: "OPENCODE_API_KEY",
156
+ models: [
157
+ { id: "jev-1.14", input: ["text"] },
158
+ { id: "gemini-decision-1", input: ["text"] },
159
+ { id: "gpt-6-luna-decision", input: ["text"] },
160
+ ],
161
+ },
149
162
  {
150
163
  id: "inception",
151
164
  route: "inception-api",
package/dist/cost.js CHANGED
@@ -29,6 +29,16 @@ const PRICES = {
29
29
  "d1.2": { inputPerMillion: 0.02, outputPerMillion: 0 },
30
30
  "d1.2-ultra": { inputPerMillion: 0.042, outputPerMillion: 0 },
31
31
  },
32
+ "opencode-go": {
33
+ "jev-1.14": { inputPerMillion: 0.042, outputPerMillion: 0 },
34
+ "gemini-decision-1": { inputPerMillion: 0.1, outputPerMillion: 0 },
35
+ "gpt-6-luna-decision": {
36
+ inputPerMillion: 0.1,
37
+ outputPerMillion: 0,
38
+ cachedInputPerMillion: 0.01,
39
+ cacheWritePerMillion: 0.125,
40
+ },
41
+ },
32
42
  cloudflare: {
33
43
  "@cf/cloudflare/clef": { inputPerMillion: 0.24, outputPerMillion: 0 },
34
44
  "@cf/cloudflare/clef-flash": { inputPerMillion: 0.038, outputPerMillion: 0 },
@@ -75,6 +85,8 @@ export function resolvePricing(provider, model, baseUrl, overrides) {
75
85
  (provider === "typesafe" && baseUrl === "https://api.typesafe.ai/v1") ||
76
86
  (provider === "perplexity" && baseUrl === "https://api.perplexity.ai/v1") ||
77
87
  (provider === "liquid" && baseUrl === "https://api.liquid.ai/decisions/v1") ||
88
+ (provider === "opencode-go" &&
89
+ baseUrl === "https://opencode.ai/inference/go/systemone/v1") ||
78
90
  ((provider === "cloudflare" || provider === "clairic") &&
79
91
  /^https:\/\/api\.cloudflare\.com\/client\/v4\/accounts\/[^/]+\/ai$/.test(baseUrl));
80
92
  const catalogKey = provider === "clairic" ? "cloudflare" : provider;
@@ -150,8 +162,12 @@ export function estimateCost(route, usage) {
150
162
  if ((cached > 0 && rates.cachedInputPerMillion === undefined) ||
151
163
  (writes > 0 && rates.cacheWritePerMillion === undefined))
152
164
  return unavailable("missing_cache_pricing");
153
- // OpenAI doubles input rates for >272K context. Overrides already define effective rates.
154
- if (route.provider === "openai" &&
165
+ // OpenAI and OpenCode Go double these decision models' rates for >272K context.
166
+ // Overrides already define effective rates.
167
+ const longContextRoute = route.provider === "openai" ||
168
+ (route.provider === "opencode-go" &&
169
+ route.model === "gpt-6-luna-decision");
170
+ if (longContextRoute &&
155
171
  route.pricing.source === "builtin" &&
156
172
  inputTokens > 272_000) {
157
173
  rates.inputPerMillion *= 2;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@abhishek944/pi-classifier",
3
- "version": "0.5.1",
4
- "description": "Config-driven typed classification and extraction for Pi via Microsoft Foundry, OpenAI Decisions, Perplexity, Sarvam, TypeSafe Jev, Liquid, Cloudflare Clef and Clairic, Gemini, Inception, Parallel, OpenRouter, Vercel and local System One runtimes.",
3
+ "version": "0.6.0",
4
+ "description": "Config-driven typed classification and extraction for Pi via Microsoft Foundry, OpenAI Decisions, Perplexity, Sarvam, TypeSafe Jev, Liquid, Cloudflare Clef and Clairic, Gemini, OpenCode Go, Inception, Parallel, OpenRouter, Vercel and local System One runtimes.",
5
5
  "keywords": [
6
6
  "pi-package",
7
7
  "pi",
@@ -9,6 +9,7 @@
9
9
  "decisions",
10
10
  "sarvam",
11
11
  "gemini",
12
+ "opencode-go",
12
13
  "inception",
13
14
  "parallel",
14
15
  "openrouter",
package/src/config.ts CHANGED
@@ -160,6 +160,19 @@ export const BUILT_INS = [
160
160
  { id: "gemini-decision-1", input: ["text", "image", "audio", "video"] },
161
161
  ],
162
162
  },
163
+ {
164
+ id: "opencode-go",
165
+ route: "opencode-go-api",
166
+ api: "system-one",
167
+ baseUrl: "https://opencode.ai/inference/go/systemone/v1",
168
+ credentialProvider: "opencode-go",
169
+ envVar: "OPENCODE_API_KEY",
170
+ models: [
171
+ { id: "jev-1.14", input: ["text"] },
172
+ { id: "gemini-decision-1", input: ["text"] },
173
+ { id: "gpt-6-luna-decision", input: ["text"] },
174
+ ],
175
+ },
163
176
  {
164
177
  id: "inception",
165
178
  route: "inception-api",
package/src/cost.ts CHANGED
@@ -39,6 +39,16 @@ const PRICES: Record<string, Record<string, TokenPricing>> = {
39
39
  "d1.2": { inputPerMillion: 0.02, outputPerMillion: 0 },
40
40
  "d1.2-ultra": { inputPerMillion: 0.042, outputPerMillion: 0 },
41
41
  },
42
+ "opencode-go": {
43
+ "jev-1.14": { inputPerMillion: 0.042, outputPerMillion: 0 },
44
+ "gemini-decision-1": { inputPerMillion: 0.1, outputPerMillion: 0 },
45
+ "gpt-6-luna-decision": {
46
+ inputPerMillion: 0.1,
47
+ outputPerMillion: 0,
48
+ cachedInputPerMillion: 0.01,
49
+ cacheWritePerMillion: 0.125,
50
+ },
51
+ },
42
52
  cloudflare: {
43
53
  "@cf/cloudflare/clef": { inputPerMillion: 0.24, outputPerMillion: 0 },
44
54
  "@cf/cloudflare/clef-flash": { inputPerMillion: 0.038, outputPerMillion: 0 },
@@ -102,6 +112,8 @@ export function resolvePricing(
102
112
  (provider === "typesafe" && baseUrl === "https://api.typesafe.ai/v1") ||
103
113
  (provider === "perplexity" && baseUrl === "https://api.perplexity.ai/v1") ||
104
114
  (provider === "liquid" && baseUrl === "https://api.liquid.ai/decisions/v1") ||
115
+ (provider === "opencode-go" &&
116
+ baseUrl === "https://opencode.ai/inference/go/systemone/v1") ||
105
117
  ((provider === "cloudflare" || provider === "clairic") &&
106
118
  /^https:\/\/api\.cloudflare\.com\/client\/v4\/accounts\/[^/]+\/ai$/.test(baseUrl));
107
119
  const catalogKey = provider === "clairic" ? "cloudflare" : provider;
@@ -195,9 +207,14 @@ export function estimateCost(
195
207
  (writes > 0 && rates.cacheWritePerMillion === undefined)
196
208
  )
197
209
  return unavailable("missing_cache_pricing");
198
- // OpenAI doubles input rates for >272K context. Overrides already define effective rates.
210
+ // OpenAI and OpenCode Go double these decision models' rates for >272K context.
211
+ // Overrides already define effective rates.
212
+ const longContextRoute =
213
+ route.provider === "openai" ||
214
+ (route.provider === "opencode-go" &&
215
+ route.model === "gpt-6-luna-decision");
199
216
  if (
200
- route.provider === "openai" &&
217
+ longContextRoute &&
201
218
  route.pricing.source === "builtin" &&
202
219
  inputTokens > 272_000
203
220
  ) {