johns-harness 2026.10.21 → 2026.10.22
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 +8 -0
- package/README.md +3 -0
- package/dist/auth-profiles-5CHn7vq1.js +4 -2
- package/dist/compact-B247y5Qt.js +28 -69
- package/dist/config-koj5M_EO.js +4 -2
- package/dist/daemon-cli.js +4 -2
- package/dist/model-selection-BGlGpPgM.js +4 -2
- package/dist/model-selection-BU6wl1le.js +4 -2
- package/dist/model-selection-L7RMwsG-.js +4 -2
- package/dist/pi-embedded-C6ITuRXf.js +29 -84
- package/dist/pi-embedded-DoQsYfIY.js +29 -84
- package/dist/plugin-sdk/bluebubbles.js +2 -1
- package/dist/plugin-sdk/config/types.models.d.ts +1 -0
- package/dist/plugin-sdk/config/zod-schema.core.d.ts +3 -0
- package/dist/plugin-sdk/config/zod-schema.d.ts +1 -0
- package/dist/plugin-sdk/config-4Fgm-yEH.js +4 -2
- package/dist/plugin-sdk/config-Di-lyCdh.js +4 -2
- package/dist/plugin-sdk/discord.js +4 -2
- package/dist/plugin-sdk/dispatch-BP0viZiL.js +29 -84
- package/dist/plugin-sdk/dispatch-CQsjmw7g.js +29 -84
- package/dist/plugin-sdk/dispatch-Cerq29sy.js +29 -84
- package/dist/plugin-sdk/dispatch-Cndjtt0g.js +29 -84
- package/dist/plugin-sdk/dispatch-UogiJYul.js +29 -84
- package/dist/plugin-sdk/feishu.js +2 -1
- package/dist/plugin-sdk/googlechat.js +2 -1
- package/dist/plugin-sdk/imessage.js +2 -1
- package/dist/plugin-sdk/model-auth-CX9cPHdC.js +4 -2
- package/dist/plugin-sdk/model-auth-Ciehz0x5.js +4 -2
- package/dist/plugin-sdk/model-auth-DVyo6JSX.js +4 -2
- package/dist/plugin-sdk/model-auth-kiHYHGrs.js +4 -2
- package/dist/plugin-sdk/model-selection-Dbj4jDYM.js +4 -2
- package/dist/plugin-sdk/nostr.js +2 -1
- package/dist/plugin-sdk/reply-DbZnH8-h.js +29 -84
- package/dist/plugin-sdk/signal.js +2 -1
- package/dist/plugin-sdk/slack.js +2 -1
- package/dist/plugin-sdk/telegram.js +2 -1
- package/dist/plugin-sdk/tlon.js +2 -1
- package/dist/plugin-sdk/twitch.js +2 -1
- package/dist/plugin-sdk/utils/usage-format.d.ts +1 -0
- package/dist/plugin-sdk/voice-call.js +2 -1
- package/dist/plugin-sdk/zalo.js +2 -1
- package/dist/plugin-sdk/zalouser.js +2 -1
- package/dist/reply-C5LKjXcC.js +28 -69
- package/dist/session-cost-usage-5CCZbVhO.js +4 -19
- package/dist/session-cost-usage-CkCo2kVx.js +4 -19
- package/dist/usage-billing.js +88 -0
- package/dist/usage-format-CNGi1eHQ.js +6 -11
- package/dist/usage-format-CvaU1ntA.js +6 -11
- package/docs/PATCHES.md +13 -1
- package/docs/providers/anthropic.md +8 -2
- package/docs/reference/token-use.md +11 -1
- package/models/models.json +33 -33
- package/node_modules/@mariozechner/pi-ai/dist/models.d.ts +1 -0
- package/node_modules/@mariozechner/pi-ai/dist/models.generated.js +32 -32
- package/node_modules/@mariozechner/pi-ai/dist/models.js +16 -5
- package/node_modules/@mariozechner/pi-ai/dist/providers/anthropic.js +15 -0
- package/node_modules/@mariozechner/pi-ai/dist/providers/google-vertex.js +1 -1
- package/node_modules/@mariozechner/pi-ai/dist/providers/google.js +1 -1
- package/node_modules/@mariozechner/pi-ai/dist/providers/openai-completions.js +5 -5
- package/node_modules/@mariozechner/pi-ai/dist/types.d.ts +3 -0
- package/node_modules/@mariozechner/pi-coding-agent/dist/core/model-registry.js +3 -0
- package/package.json +1 -1
- package/scripts/models-sync.mjs +1 -0
- package/vendor/patched-deps/@mariozechner/pi-ai/dist/models.d.ts +25 -0
- package/vendor/patched-deps/@mariozechner/pi-ai/dist/models.generated.js +32 -32
- package/vendor/patched-deps/@mariozechner/pi-ai/dist/models.js +16 -5
- package/vendor/patched-deps/@mariozechner/pi-ai/dist/providers/anthropic.js +15 -0
- package/vendor/patched-deps/@mariozechner/pi-ai/dist/providers/google-vertex.js +371 -0
- package/vendor/patched-deps/@mariozechner/pi-ai/dist/providers/google.js +1 -1
- package/vendor/patched-deps/@mariozechner/pi-ai/dist/providers/openai-completions.js +5 -5
- package/vendor/patched-deps/@mariozechner/pi-ai/dist/types.d.ts +282 -0
- package/vendor/patched-deps/@mariozechner/pi-coding-agent/dist/core/model-registry.js +3 -0
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getModel, johnnessUsageCost } from "@mariozechner/pi-ai";
|
|
2
|
+
// JOHNNESS_PATCH_USAGE_BILLING_91
|
|
1
3
|
//#region src/utils/usage-format.ts
|
|
2
4
|
function formatTokenCount(value) {
|
|
3
5
|
if (value === void 0 || !Number.isFinite(value)) return "0";
|
|
@@ -21,20 +23,13 @@ function resolveModelCostConfig(params) {
|
|
|
21
23
|
const provider = params.provider?.trim();
|
|
22
24
|
const model = params.model?.trim();
|
|
23
25
|
if (!provider || !model) return;
|
|
24
|
-
return ((params.config?.models?.providers ?? {})[provider]?.models?.find((item) => item.id === model))?.cost;
|
|
26
|
+
return ((params.config?.models?.providers ?? {})[provider]?.models?.find((item) => item.id === model))?.cost ?? getModel(provider, model)?.cost;
|
|
25
27
|
}
|
|
26
28
|
const toNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
27
29
|
function estimateUsageCost(params) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const input = toNumber(usage.input);
|
|
32
|
-
const output = toNumber(usage.output);
|
|
33
|
-
const cacheRead = toNumber(usage.cacheRead);
|
|
34
|
-
const cacheWrite = toNumber(usage.cacheWrite);
|
|
35
|
-
const total = input * cost.input + output * cost.output + cacheRead * cost.cacheRead + cacheWrite * cost.cacheWrite;
|
|
36
|
-
if (!Number.isFinite(total)) return;
|
|
37
|
-
return total / 1e6;
|
|
30
|
+
const recorded = params.usage?.cost?.total;
|
|
31
|
+
if (typeof recorded === "number" && Number.isFinite(recorded) && recorded >= 0) return recorded;
|
|
32
|
+
return johnnessUsageCost(params.usage, params.cost)?.total;
|
|
38
33
|
}
|
|
39
34
|
//#endregion
|
|
40
35
|
export { resolveModelCostConfig as i, formatTokenCount as n, formatUsd as r, estimateUsageCost as t };
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { getModel, johnnessUsageCost } from "@mariozechner/pi-ai";
|
|
2
|
+
// JOHNNESS_PATCH_USAGE_BILLING_91
|
|
1
3
|
//#region src/utils/usage-format.ts
|
|
2
4
|
function formatTokenCount(value) {
|
|
3
5
|
if (value === void 0 || !Number.isFinite(value)) return "0";
|
|
@@ -21,20 +23,13 @@ function resolveModelCostConfig(params) {
|
|
|
21
23
|
const provider = params.provider?.trim();
|
|
22
24
|
const model = params.model?.trim();
|
|
23
25
|
if (!provider || !model) return;
|
|
24
|
-
return ((params.config?.models?.providers ?? {})[provider]?.models?.find((item) => item.id === model))?.cost;
|
|
26
|
+
return ((params.config?.models?.providers ?? {})[provider]?.models?.find((item) => item.id === model))?.cost ?? getModel(provider, model)?.cost;
|
|
25
27
|
}
|
|
26
28
|
const toNumber = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
27
29
|
function estimateUsageCost(params) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
const input = toNumber(usage.input);
|
|
32
|
-
const output = toNumber(usage.output);
|
|
33
|
-
const cacheRead = toNumber(usage.cacheRead);
|
|
34
|
-
const cacheWrite = toNumber(usage.cacheWrite);
|
|
35
|
-
const total = input * cost.input + output * cost.output + cacheRead * cost.cacheRead + cacheWrite * cost.cacheWrite;
|
|
36
|
-
if (!Number.isFinite(total)) return;
|
|
37
|
-
return total / 1e6;
|
|
30
|
+
const recorded = params.usage?.cost?.total;
|
|
31
|
+
if (typeof recorded === "number" && Number.isFinite(recorded) && recorded >= 0) return recorded;
|
|
32
|
+
return johnnessUsageCost(params.usage, params.cost)?.total;
|
|
38
33
|
}
|
|
39
34
|
//#endregion
|
|
40
35
|
export { resolveModelCostConfig as i, formatTokenCount as n, formatUsd as r, estimateUsageCost as t };
|
package/docs/PATCHES.md
CHANGED
|
@@ -17,7 +17,7 @@ they predate ~2026-06-06).
|
|
|
17
17
|
|
|
18
18
|
## Index
|
|
19
19
|
|
|
20
|
-
Current addition: [
|
|
20
|
+
Current addition: [91 - Exact API usage billing](#91---exact-api-usage-billing-2026-10-21).
|
|
21
21
|
|
|
22
22
|
Family 01 is retired. Families 02 through 41, 43 through 81, including the 65.1 amendment, are live on `main`; the `latest` and `extended` release lines converged at 2026.9.24. Family 42 is omitted; native Codex OAuth ownership is Family 58.
|
|
23
23
|
|
|
@@ -3063,3 +3063,15 @@ the already-exhausted five-hour limit; the successful proof waited for its reset
|
|
|
3063
3063
|
gateway restart, live state access or new login. Verifier 564/564; full suite 1,249 pass, 5 existing skips.
|
|
3064
3064
|
|
|
3065
3065
|
**Rollback:** `npm i -g johns-harness@2026.10.20`.
|
|
3066
|
+
|
|
3067
|
+
## 91 - Exact API usage billing (2026-10-21)
|
|
3068
|
+
|
|
3069
|
+
**Release:** `johns-harness@2026.10.22`. Marker `JOHNNESS_PATCH_USAGE_BILLING_91`.
|
|
3070
|
+
|
|
3071
|
+
**Root cause:** status discarded cache buckets when estimating cost, used only the tiny Anthropic uncached suffix as input, and mixed store/log counters. The Anthropic adapter retained cache creation totals but lost their TTL split, pricing the new one-hour default at the five-minute rate. Google counted cached input twice; compatible completions ignored DeepSeek hits and double-counted OpenAI reasoning.
|
|
3072
|
+
|
|
3073
|
+
**Change:** shared disjoint-bucket normalization and pricing; native TTL preservation including mixed responses; catalog one-hour prices; recorded cost preferred (including subscription zero and service-tier multipliers); all ten status copies use complete latest-response counters with explicit input/read/write/output costs. The backward transcript reader also sums calls since the latest user boundary to show multi-call turn spend. Cumulative session summaries use the same costs and preserve the breakdown on fallback estimates. Old costs with missing TTL information are not fabricated.
|
|
3074
|
+
|
|
3075
|
+
**Artifacts:** `dist/usage-billing.js`, `patches/usage-billing-91/changes.json`, `scripts/patch-usage-billing-91.py`, `tests/usage-billing-91.test.mjs`, provider-shaped offline fixtures in `tests/fixtures/usage-billing-91.json`. Fixture counts reproduce the reported rounded 148k/155k scenario; they are not a newly billed live request. Native Anthropic, OpenAI and Google SDK streams are exercised offline, plus DeepSeek and cumulative/session status paths. Exact historical reversals route by bundle path to avoid ambiguous minified aliases. The added Vertex overlay remains pinned to pi-ai 0.55.3.
|
|
3076
|
+
|
|
3077
|
+
**Rollback:** `npm i -g johns-harness@2026.10.21`. No migration or live-state edit required. No invoice-tax or negotiated-price claim; costs use configured/catalog token rates.
|
|
@@ -55,8 +55,8 @@ Use the `cacheRetention` parameter in your model config:
|
|
|
55
55
|
| Value | Cache Duration | Description |
|
|
56
56
|
| ------- | -------------- | ----------------------------------- |
|
|
57
57
|
| `none` | No caching | Disable prompt caching |
|
|
58
|
-
| `short` | 5 minutes |
|
|
59
|
-
| `long` | 1 hour |
|
|
58
|
+
| `short` | 5 minutes | Explicit shorter retention |
|
|
59
|
+
| `long` | 1 hour | Default for API key and subscription |
|
|
60
60
|
|
|
61
61
|
```json5
|
|
62
62
|
{
|
|
@@ -232,3 +232,9 @@ johnness onboard --auth-choice setup-token
|
|
|
232
232
|
- Add another Anthropic profile or wait for cooldown.
|
|
233
233
|
|
|
234
234
|
More: [/gateway/troubleshooting](/gateway/troubleshooting) and [/help/faq](/help/faq).
|
|
235
|
+
|
|
236
|
+
### Cache billing in status
|
|
237
|
+
|
|
238
|
+
`/status` and `session_status` show uncached input plus cache writes as **new in**, cache reads separately, and output. The cost breakdown separately prices input, reads, writes and output. Anthropic's `cache_creation.ephemeral_5m_input_tokens` and `ephemeral_1h_input_tokens` determine the write rate, including mixed-TTL responses. If the older response omits this split, the adapter uses the TTL actually sent on that request, not the current session setting. Five-minute writes use `cost.cacheWrite`; one-hour writes use `cost.cacheWrite1h` from the catalog (2x input for custom model pricing).
|
|
239
|
+
|
|
240
|
+
The last API response and multi-call turn total are distinct. A tool-heavy turn can have many charged API requests; its total is shown separately. Subscription responses still record zero monetary cost. API fallback responses carry their actual token-rate cost. Historical records without duration metadata retain their recorded cost; changing the default cannot retrospectively recover that missing information.
|
|
@@ -49,7 +49,9 @@ For a practical breakdown (per injected file, tools, skills, and system prompt s
|
|
|
49
49
|
Use these in chat:
|
|
50
50
|
|
|
51
51
|
- `/status` → **emoji‑rich status card** with the session model, context usage,
|
|
52
|
-
last response input/output tokens
|
|
52
|
+
last API response new-input/cached/output tokens and the recorded API cost
|
|
53
|
+
broken down into input, cache reads, cache writes and output. Multi-call turns
|
|
54
|
+
also show a turn total. Missing recorded cost is explicitly marked `est.`.
|
|
53
55
|
- `/usage off|tokens|full` → appends a **per-response usage footer** to every reply.
|
|
54
56
|
- Persists per session (stored as `responseUsage`).
|
|
55
57
|
- OAuth auth **hides cost** (tokens only).
|
|
@@ -173,3 +175,11 @@ rejects that combination with HTTP 401.
|
|
|
173
175
|
- Prefer smaller models for verbose, exploratory work.
|
|
174
176
|
|
|
175
177
|
See [Skills](/tools/skills) for the exact skill list overhead formula.
|
|
178
|
+
|
|
179
|
+
## Billing buckets
|
|
180
|
+
|
|
181
|
+
Provider input counters do not all mean the same thing. Anthropic `input_tokens` excludes both cache buckets. OpenAI and Google prompt totals include cached reads, which must be subtracted before charging ordinary input. DeepSeek exposes cache hits as `prompt_cache_hit_tokens`. Reasoning tokens are already included in OpenAI output; Google's thought count is separate and is added once.
|
|
182
|
+
|
|
183
|
+
Status uses a coherent native response snapshot, not a mixture of a run's output and another call's cache counters. **New in = uncached input + cache writes**, not just the small uncached suffix. Writes are not ordinary input: their duration-specific rates are applied separately. For example, 4 uncached input + 148,000 one-hour writes + 158 output on the catalog's Fable 5.1 rates costs **$2.96794**, not $0.00794. A plain uncached 148,000-token prompt with no cache write would use the ordinary input rate instead.
|
|
184
|
+
|
|
185
|
+
Costs are token-rate charges calculated from the configured model/catalog prices, not invoice taxes, credits or negotiated account discounts. Provider-recorded adjustments such as OpenAI service tiers and subscription-zero accounting are preserved rather than recomputed by status. `/usage cost` sums the same recorded cost components across the session. Historical entries lacking TTL detail cannot be corrected exactly after the fact.
|
package/models/models.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"about": "Master model file for John's Harness (family 83). Every shipped catalog entry, wire rule and alias lives here; scripts/models-sync.mjs generates every copy in the tree from it. See docs/MODELS.md.",
|
|
3
|
-
"fields": "providers.<provider>.<id>: the pi-ai catalog card (name, api, baseUrl, reasoning, input, cost per MTok, contextWindow = the window the harness uses, maxTokens). harness.xhigh: /think xhigh and wire xhigh allowed. harness.efforts: reasoning efforts the API accepts (others map to the nearest accepted). harness.temperature: drop | drop-unless-effort-none. Anthropic (anthropic-messages) only: harness.thinking adaptive (adaptive thinking + output_config.effort instead of budget_tokens), harness.thinkingOff disabled (thinking.type disabled when /think is off), harness.efforts low..max, harness.temperature drop (also top_p/top_k). harness.nativeContextWindow/source/checked/notes: documentation only. cost is flat; tiered official prices keep the base tier here and the rest in harness.notes. Google native (google-generative-ai): harness.thinking level sends thinkingConfig.thinkingLevel rather than thinkingBudget; thinkingDefault plus efforts governs all /think levels including the non-disableable provider default; cache implicit-only refuses explicit cachedContent. Ordinary per-stream maxTokens only; long decode/continuation is not implemented.",
|
|
3
|
+
"fields": "providers.<provider>.<id>: the pi-ai catalog card (name, api, baseUrl, reasoning, input, cost per MTok, contextWindow = the window the harness uses, maxTokens). harness.xhigh: /think xhigh and wire xhigh allowed. harness.efforts: reasoning efforts the API accepts (others map to the nearest accepted). harness.temperature: drop | drop-unless-effort-none. Anthropic (anthropic-messages) only: harness.thinking adaptive (adaptive thinking + output_config.effort instead of budget_tokens), harness.thinkingOff disabled (thinking.type disabled when /think is off), harness.efforts low..max, harness.temperature drop (also top_p/top_k). harness.nativeContextWindow/source/checked/notes: documentation only. cost.cacheWrite1h is the native Anthropic one-hour write price (cacheWrite is five-minute). Otherwise cost is flat; tiered official prices keep the base tier here and the rest in harness.notes. Google native (google-generative-ai): harness.thinking level sends thinkingConfig.thinkingLevel rather than thinkingBudget; thinkingDefault plus efforts governs all /think levels including the non-disableable provider default; cache implicit-only refuses explicit cachedContent. Ordinary per-stream maxTokens only; long decode/continuation is not implemented.",
|
|
4
4
|
"imageGenerationDefault": {
|
|
5
5
|
"primary": "openai-codex/gpt-image-2.5-sunburst",
|
|
6
6
|
"fallbacks": ["openai-codex/gpt-image-2"]
|
|
@@ -152,38 +152,38 @@
|
|
|
152
152
|
"zai.glm-4.7-flash": {"name":"GLM-4.7-Flash","api":"bedrock-converse-stream","baseUrl":"https://bedrock-runtime.us-east-1.amazonaws.com","reasoning":true,"input":["text"],"cost":{"input":0.07,"output":0.4,"cacheRead":0,"cacheWrite":0},"contextWindow":200000,"maxTokens":131072}
|
|
153
153
|
},
|
|
154
154
|
"anthropic": {
|
|
155
|
-
"claude-3-5-haiku-20241022": {"name":"Claude Haiku 3.5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":0.8,"output":4,"cacheRead":0.08,"cacheWrite":1},"contextWindow":200000,"maxTokens":8192},
|
|
156
|
-
"claude-3-5-haiku-latest": {"name":"Claude Haiku 3.5 (latest)","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":0.8,"output":4,"cacheRead":0.08,"cacheWrite":1},"contextWindow":200000,"maxTokens":8192},
|
|
157
|
-
"claude-3-5-sonnet-20240620": {"name":"Claude Sonnet 3.5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":8192},
|
|
158
|
-
"claude-3-5-sonnet-20241022": {"name":"Claude Sonnet 3.5 v2","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":8192},
|
|
159
|
-
"claude-3-7-sonnet-20250219": {"name":"Claude Sonnet 3.7","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":64000},
|
|
160
|
-
"claude-3-7-sonnet-latest": {"name":"Claude Sonnet 3.7 (latest)","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":64000},
|
|
161
|
-
"claude-3-haiku-20240307": {"name":"Claude Haiku 3","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":0.25,"output":1.25,"cacheRead":0.03,"cacheWrite":0.3},"contextWindow":200000,"maxTokens":4096},
|
|
162
|
-
"claude-3-opus-20240229": {"name":"Claude Opus 3","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75},"contextWindow":200000,"maxTokens":4096},
|
|
163
|
-
"claude-3-sonnet-20240229": {"name":"Claude Sonnet 3","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":0.3},"contextWindow":200000,"maxTokens":4096},
|
|
164
|
-
"claude-fable-5-1": {"name":"Claude Fable 5.1","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":10,"output":50,"cacheRead":0.25,"cacheWrite":12.5},"contextWindow":300000,"maxTokens":128000,"harness":{"xhigh":true}},
|
|
165
|
-
"claude-sonnet-5-5": {"name":"Claude Sonnet 5.5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.1,"cacheWrite":2.5},"contextWindow":1000000,"maxTokens":128000,"harness":{"xhigh":true,"source":"docs.claude.com/docs/en/about-claude/pricing (cache read 0.05x on Claude Opus 5.5 and Claude Sonnet 5.5) and the 2026-10-07 release notes","checked":"2026-10-08","notes":"Cache reads lowered from $0.20 to $0.10/MTok on 2026-10-07; cache writes and all other prices unchanged."}},
|
|
166
|
-
"claude-opus-5-5": {"name":"Claude Opus 5.5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":4,"output":20,"cacheRead":0.2,"cacheWrite":5},"contextWindow":500000,"maxTokens":128000,"harness":{"xhigh":true}},
|
|
167
|
-
"claude-haiku-5-5": {"name":"Claude Haiku 5.5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":0.1,"output":0.5,"cacheRead":0.01,"cacheWrite":0.125},"contextWindow":1000000,"maxTokens":128000,"harness":{"xhigh":true,"thinking":"adaptive","thinkingOff":"disabled","efforts":["low","medium","high","xhigh","max"],"temperature":"drop","nativeContextWindow":1000000,"source":"docs.claude.com/docs/en/models/haiku-5-5/overview, /docs/en/about-claude/pricing, /docs/en/build-with-claude/effort, /docs/en/build-with-claude/thinking and the 2026-10-07 release notes; GET api.anthropic.com/v1/models/claude-haiku-5-5 (max_input_tokens 1000000, max_tokens 128000, effort low..max supported, thinking adaptive and disabled supported, enabled unsupported)","checked":"2026-10-08","notes":"GA 2026-10-07. Adaptive thinking is on by default (display omitted), default effort medium. thinking.type enabled (budget_tokens) returns 400 (live), so the adapter must send adaptive + output_config.effort. Non-default temperature/top_p/top_k return 400 (live: temperature 400). Pricing is tiered by prompt length: prompts up to 100K tokens $0.10 input, $0.50 output, $0.01 cache read, $0.125 5m cache write, $0.20 1h cache write per MTok; prompts over 100K $0.50, $2.50, $0.05, $0.625, $1.00. cost holds the up-to-100K tier because the catalog cost is flat, so usage estimates for prompts over 100K tokens read 5x low. Batch 50% off. Newer tokenizer (about 30% more tokens than Haiku 4.5). Knowledge cutoff Jun 2026."}},
|
|
168
|
-
"claude-opus-5": {"name":"Claude Opus 5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":300000,"maxTokens":128000,"harness":{"xhigh":true}},
|
|
169
|
-
"claude-sonnet-5": {"name":"Claude Sonnet 5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.2,"cacheWrite":2.5},"contextWindow":1000000,"maxTokens":128000,"harness":{"xhigh":true}},
|
|
170
|
-
"claude-fable-5": {"name":"Claude Fable 5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":10,"output":50,"cacheRead":1,"cacheWrite":12.5},"contextWindow":300000,"maxTokens":128000,"harness":{"xhigh":true}},
|
|
171
|
-
"claude-opus-4-8": {"name":"Claude Opus 4.8","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":300000,"maxTokens":32000},
|
|
172
|
-
"claude-opus-4-7": {"name":"Claude Opus 4.7","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":32000},
|
|
173
|
-
"claude-haiku-4-5": {"name":"Claude Haiku 4.5 (latest)","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25},"contextWindow":200000,"maxTokens":64000},
|
|
174
|
-
"claude-haiku-4-5-20251001": {"name":"Claude Haiku 4.5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25},"contextWindow":200000,"maxTokens":64000},
|
|
175
|
-
"claude-opus-4-0": {"name":"Claude Opus 4 (latest)","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75},"contextWindow":200000,"maxTokens":32000},
|
|
176
|
-
"claude-opus-4-1": {"name":"Claude Opus 4.1 (latest)","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75},"contextWindow":200000,"maxTokens":32000},
|
|
177
|
-
"claude-opus-4-1-20250805": {"name":"Claude Opus 4.1","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75},"contextWindow":200000,"maxTokens":32000},
|
|
178
|
-
"claude-opus-4-20250514": {"name":"Claude Opus 4","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75},"contextWindow":200000,"maxTokens":32000},
|
|
179
|
-
"claude-opus-4-5": {"name":"Claude Opus 4.5 (latest)","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":64000},
|
|
180
|
-
"claude-opus-4-5-20251101": {"name":"Claude Opus 4.5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":64000},
|
|
181
|
-
"claude-opus-4-6": {"name":"Claude Opus 4.6","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":128000,"harness":{"xhigh":true}},
|
|
182
|
-
"claude-sonnet-4-0": {"name":"Claude Sonnet 4 (latest)","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":64000},
|
|
183
|
-
"claude-sonnet-4-20250514": {"name":"Claude Sonnet 4","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":64000},
|
|
184
|
-
"claude-sonnet-4-5": {"name":"Claude Sonnet 4.5 (latest)","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":64000},
|
|
185
|
-
"claude-sonnet-4-5-20250929": {"name":"Claude Sonnet 4.5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":64000},
|
|
186
|
-
"claude-sonnet-4-6": {"name":"Claude Sonnet 4.6","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":1000000,"maxTokens":64000}
|
|
155
|
+
"claude-3-5-haiku-20241022": {"name":"Claude Haiku 3.5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":0.8,"output":4,"cacheRead":0.08,"cacheWrite":1,"cacheWrite1h":1.6},"contextWindow":200000,"maxTokens":8192},
|
|
156
|
+
"claude-3-5-haiku-latest": {"name":"Claude Haiku 3.5 (latest)","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":0.8,"output":4,"cacheRead":0.08,"cacheWrite":1,"cacheWrite1h":1.6},"contextWindow":200000,"maxTokens":8192},
|
|
157
|
+
"claude-3-5-sonnet-20240620": {"name":"Claude Sonnet 3.5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75,"cacheWrite1h":6},"contextWindow":200000,"maxTokens":8192},
|
|
158
|
+
"claude-3-5-sonnet-20241022": {"name":"Claude Sonnet 3.5 v2","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75,"cacheWrite1h":6},"contextWindow":200000,"maxTokens":8192},
|
|
159
|
+
"claude-3-7-sonnet-20250219": {"name":"Claude Sonnet 3.7","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75,"cacheWrite1h":6},"contextWindow":200000,"maxTokens":64000},
|
|
160
|
+
"claude-3-7-sonnet-latest": {"name":"Claude Sonnet 3.7 (latest)","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75,"cacheWrite1h":6},"contextWindow":200000,"maxTokens":64000},
|
|
161
|
+
"claude-3-haiku-20240307": {"name":"Claude Haiku 3","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":0.25,"output":1.25,"cacheRead":0.03,"cacheWrite":0.3,"cacheWrite1h":0.5},"contextWindow":200000,"maxTokens":4096},
|
|
162
|
+
"claude-3-opus-20240229": {"name":"Claude Opus 3","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75,"cacheWrite1h":30},"contextWindow":200000,"maxTokens":4096},
|
|
163
|
+
"claude-3-sonnet-20240229": {"name":"Claude Sonnet 3","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":0.3,"cacheWrite1h":6},"contextWindow":200000,"maxTokens":4096},
|
|
164
|
+
"claude-fable-5-1": {"name":"Claude Fable 5.1","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":10,"output":50,"cacheRead":0.25,"cacheWrite":12.5,"cacheWrite1h":20},"contextWindow":300000,"maxTokens":128000,"harness":{"xhigh":true}},
|
|
165
|
+
"claude-sonnet-5-5": {"name":"Claude Sonnet 5.5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.1,"cacheWrite":2.5,"cacheWrite1h":4},"contextWindow":1000000,"maxTokens":128000,"harness":{"xhigh":true,"source":"docs.claude.com/docs/en/about-claude/pricing (cache read 0.05x on Claude Opus 5.5 and Claude Sonnet 5.5) and the 2026-10-07 release notes","checked":"2026-10-08","notes":"Cache reads lowered from $0.20 to $0.10/MTok on 2026-10-07; cache writes and all other prices unchanged."}},
|
|
166
|
+
"claude-opus-5-5": {"name":"Claude Opus 5.5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":4,"output":20,"cacheRead":0.2,"cacheWrite":5,"cacheWrite1h":8},"contextWindow":500000,"maxTokens":128000,"harness":{"xhigh":true}},
|
|
167
|
+
"claude-haiku-5-5": {"name":"Claude Haiku 5.5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":0.1,"output":0.5,"cacheRead":0.01,"cacheWrite":0.125,"cacheWrite1h":0.2},"contextWindow":1000000,"maxTokens":128000,"harness":{"xhigh":true,"thinking":"adaptive","thinkingOff":"disabled","efforts":["low","medium","high","xhigh","max"],"temperature":"drop","nativeContextWindow":1000000,"source":"docs.claude.com/docs/en/models/haiku-5-5/overview, /docs/en/about-claude/pricing, /docs/en/build-with-claude/effort, /docs/en/build-with-claude/thinking and the 2026-10-07 release notes; GET api.anthropic.com/v1/models/claude-haiku-5-5 (max_input_tokens 1000000, max_tokens 128000, effort low..max supported, thinking adaptive and disabled supported, enabled unsupported)","checked":"2026-10-08","notes":"GA 2026-10-07. Adaptive thinking is on by default (display omitted), default effort medium. thinking.type enabled (budget_tokens) returns 400 (live), so the adapter must send adaptive + output_config.effort. Non-default temperature/top_p/top_k return 400 (live: temperature 400). Pricing is tiered by prompt length: prompts up to 100K tokens $0.10 input, $0.50 output, $0.01 cache read, $0.125 5m cache write, $0.20 1h cache write per MTok; prompts over 100K $0.50, $2.50, $0.05, $0.625, $1.00. cost holds the up-to-100K tier because the catalog cost is flat, so usage estimates for prompts over 100K tokens read 5x low. Batch 50% off. Newer tokenizer (about 30% more tokens than Haiku 4.5). Knowledge cutoff Jun 2026."}},
|
|
168
|
+
"claude-opus-5": {"name":"Claude Opus 5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25,"cacheWrite1h":10},"contextWindow":300000,"maxTokens":128000,"harness":{"xhigh":true}},
|
|
169
|
+
"claude-sonnet-5": {"name":"Claude Sonnet 5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.2,"cacheWrite":2.5,"cacheWrite1h":4},"contextWindow":1000000,"maxTokens":128000,"harness":{"xhigh":true}},
|
|
170
|
+
"claude-fable-5": {"name":"Claude Fable 5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":10,"output":50,"cacheRead":1,"cacheWrite":12.5,"cacheWrite1h":20},"contextWindow":300000,"maxTokens":128000,"harness":{"xhigh":true}},
|
|
171
|
+
"claude-opus-4-8": {"name":"Claude Opus 4.8","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25,"cacheWrite1h":10},"contextWindow":300000,"maxTokens":32000},
|
|
172
|
+
"claude-opus-4-7": {"name":"Claude Opus 4.7","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25,"cacheWrite1h":10},"contextWindow":200000,"maxTokens":32000},
|
|
173
|
+
"claude-haiku-4-5": {"name":"Claude Haiku 4.5 (latest)","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25,"cacheWrite1h":2},"contextWindow":200000,"maxTokens":64000},
|
|
174
|
+
"claude-haiku-4-5-20251001": {"name":"Claude Haiku 4.5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25,"cacheWrite1h":2},"contextWindow":200000,"maxTokens":64000},
|
|
175
|
+
"claude-opus-4-0": {"name":"Claude Opus 4 (latest)","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75,"cacheWrite1h":30},"contextWindow":200000,"maxTokens":32000},
|
|
176
|
+
"claude-opus-4-1": {"name":"Claude Opus 4.1 (latest)","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75,"cacheWrite1h":30},"contextWindow":200000,"maxTokens":32000},
|
|
177
|
+
"claude-opus-4-1-20250805": {"name":"Claude Opus 4.1","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75,"cacheWrite1h":30},"contextWindow":200000,"maxTokens":32000},
|
|
178
|
+
"claude-opus-4-20250514": {"name":"Claude Opus 4","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75,"cacheWrite1h":30},"contextWindow":200000,"maxTokens":32000},
|
|
179
|
+
"claude-opus-4-5": {"name":"Claude Opus 4.5 (latest)","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25,"cacheWrite1h":10},"contextWindow":200000,"maxTokens":64000},
|
|
180
|
+
"claude-opus-4-5-20251101": {"name":"Claude Opus 4.5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25,"cacheWrite1h":10},"contextWindow":200000,"maxTokens":64000},
|
|
181
|
+
"claude-opus-4-6": {"name":"Claude Opus 4.6","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25,"cacheWrite1h":10},"contextWindow":200000,"maxTokens":128000,"harness":{"xhigh":true}},
|
|
182
|
+
"claude-sonnet-4-0": {"name":"Claude Sonnet 4 (latest)","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75,"cacheWrite1h":6},"contextWindow":200000,"maxTokens":64000},
|
|
183
|
+
"claude-sonnet-4-20250514": {"name":"Claude Sonnet 4","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75,"cacheWrite1h":6},"contextWindow":200000,"maxTokens":64000},
|
|
184
|
+
"claude-sonnet-4-5": {"name":"Claude Sonnet 4.5 (latest)","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75,"cacheWrite1h":6},"contextWindow":200000,"maxTokens":64000},
|
|
185
|
+
"claude-sonnet-4-5-20250929": {"name":"Claude Sonnet 4.5","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75,"cacheWrite1h":6},"contextWindow":200000,"maxTokens":64000},
|
|
186
|
+
"claude-sonnet-4-6": {"name":"Claude Sonnet 4.6","api":"anthropic-messages","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75,"cacheWrite1h":6},"contextWindow":1000000,"maxTokens":64000}
|
|
187
187
|
},
|
|
188
188
|
"azure-openai-responses": {
|
|
189
189
|
"codex-mini-latest": {"name":"Codex Mini","api":"azure-openai-responses","baseUrl":"","reasoning":true,"input":["text"],"cost":{"input":1.5,"output":6,"cacheRead":0.375,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000},
|
|
@@ -7,6 +7,7 @@ export declare function getModel<TProvider extends KnownProvider, TModelId exten
|
|
|
7
7
|
export declare function getProviders(): KnownProvider[];
|
|
8
8
|
export declare function getModels<TProvider extends KnownProvider>(provider: TProvider): Model<ModelApi<TProvider, keyof (typeof MODELS)[TProvider]>>[];
|
|
9
9
|
export declare function calculateCost<TApi extends Api>(model: Model<TApi>, usage: Usage): Usage["cost"];
|
|
10
|
+
export declare function johnnessUsageCost(usage: Partial<Usage>, rates: Model<Api>["cost"]): Usage["cost"] | undefined;
|
|
10
11
|
/**
|
|
11
12
|
* Check if a model supports xhigh thinking level.
|
|
12
13
|
*
|
|
@@ -13742,38 +13742,38 @@ const JOHNNESS_MODELS_MASTER = {
|
|
|
13742
13742
|
"zai.glm-4.7-flash":{"id":"zai.glm-4.7-flash","name":"GLM-4.7-Flash","api":"bedrock-converse-stream","provider":"amazon-bedrock","baseUrl":"https://bedrock-runtime.us-east-1.amazonaws.com","reasoning":true,"input":["text"],"cost":{"input":0.07,"output":0.4,"cacheRead":0,"cacheWrite":0},"contextWindow":200000,"maxTokens":131072},
|
|
13743
13743
|
},
|
|
13744
13744
|
"anthropic": {
|
|
13745
|
-
"claude-3-5-haiku-20241022":{"id":"claude-3-5-haiku-20241022","name":"Claude Haiku 3.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":0.8,"output":4,"cacheRead":0.08,"cacheWrite":1},"contextWindow":200000,"maxTokens":8192},
|
|
13746
|
-
"claude-3-5-haiku-latest":{"id":"claude-3-5-haiku-latest","name":"Claude Haiku 3.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":0.8,"output":4,"cacheRead":0.08,"cacheWrite":1},"contextWindow":200000,"maxTokens":8192},
|
|
13747
|
-
"claude-3-5-sonnet-20240620":{"id":"claude-3-5-sonnet-20240620","name":"Claude Sonnet 3.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":8192},
|
|
13748
|
-
"claude-3-5-sonnet-20241022":{"id":"claude-3-5-sonnet-20241022","name":"Claude Sonnet 3.5 v2","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":8192},
|
|
13749
|
-
"claude-3-7-sonnet-20250219":{"id":"claude-3-7-sonnet-20250219","name":"Claude Sonnet 3.7","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":64000},
|
|
13750
|
-
"claude-3-7-sonnet-latest":{"id":"claude-3-7-sonnet-latest","name":"Claude Sonnet 3.7 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":64000},
|
|
13751
|
-
"claude-3-haiku-20240307":{"id":"claude-3-haiku-20240307","name":"Claude Haiku 3","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":0.25,"output":1.25,"cacheRead":0.03,"cacheWrite":0.3},"contextWindow":200000,"maxTokens":4096},
|
|
13752
|
-
"claude-3-opus-20240229":{"id":"claude-3-opus-20240229","name":"Claude Opus 3","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75},"contextWindow":200000,"maxTokens":4096},
|
|
13753
|
-
"claude-3-sonnet-20240229":{"id":"claude-3-sonnet-20240229","name":"Claude Sonnet 3","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":0.3},"contextWindow":200000,"maxTokens":4096},
|
|
13754
|
-
"claude-fable-5-1":{"id":"claude-fable-5-1","name":"Claude Fable 5.1","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":10,"output":50,"cacheRead":0.25,"cacheWrite":12.5},"contextWindow":300000,"maxTokens":128000},
|
|
13755
|
-
"claude-sonnet-5-5":{"id":"claude-sonnet-5-5","name":"Claude Sonnet 5.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.1,"cacheWrite":2.5},"contextWindow":1000000,"maxTokens":128000},
|
|
13756
|
-
"claude-opus-5-5":{"id":"claude-opus-5-5","name":"Claude Opus 5.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":4,"output":20,"cacheRead":0.2,"cacheWrite":5},"contextWindow":500000,"maxTokens":128000},
|
|
13757
|
-
"claude-haiku-5-5":{"id":"claude-haiku-5-5","name":"Claude Haiku 5.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":0.1,"output":0.5,"cacheRead":0.01,"cacheWrite":0.125},"contextWindow":1000000,"maxTokens":128000},
|
|
13758
|
-
"claude-opus-5":{"id":"claude-opus-5","name":"Claude Opus 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":300000,"maxTokens":128000},
|
|
13759
|
-
"claude-sonnet-5":{"id":"claude-sonnet-5","name":"Claude Sonnet 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.2,"cacheWrite":2.5},"contextWindow":1000000,"maxTokens":128000},
|
|
13760
|
-
"claude-fable-5":{"id":"claude-fable-5","name":"Claude Fable 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":10,"output":50,"cacheRead":1,"cacheWrite":12.5},"contextWindow":300000,"maxTokens":128000},
|
|
13761
|
-
"claude-opus-4-8":{"id":"claude-opus-4-8","name":"Claude Opus 4.8","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":300000,"maxTokens":32000},
|
|
13762
|
-
"claude-opus-4-7":{"id":"claude-opus-4-7","name":"Claude Opus 4.7","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":32000},
|
|
13763
|
-
"claude-haiku-4-5":{"id":"claude-haiku-4-5","name":"Claude Haiku 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25},"contextWindow":200000,"maxTokens":64000},
|
|
13764
|
-
"claude-haiku-4-5-20251001":{"id":"claude-haiku-4-5-20251001","name":"Claude Haiku 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25},"contextWindow":200000,"maxTokens":64000},
|
|
13765
|
-
"claude-opus-4-0":{"id":"claude-opus-4-0","name":"Claude Opus 4 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75},"contextWindow":200000,"maxTokens":32000},
|
|
13766
|
-
"claude-opus-4-1":{"id":"claude-opus-4-1","name":"Claude Opus 4.1 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75},"contextWindow":200000,"maxTokens":32000},
|
|
13767
|
-
"claude-opus-4-1-20250805":{"id":"claude-opus-4-1-20250805","name":"Claude Opus 4.1","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75},"contextWindow":200000,"maxTokens":32000},
|
|
13768
|
-
"claude-opus-4-20250514":{"id":"claude-opus-4-20250514","name":"Claude Opus 4","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75},"contextWindow":200000,"maxTokens":32000},
|
|
13769
|
-
"claude-opus-4-5":{"id":"claude-opus-4-5","name":"Claude Opus 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":64000},
|
|
13770
|
-
"claude-opus-4-5-20251101":{"id":"claude-opus-4-5-20251101","name":"Claude Opus 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":64000},
|
|
13771
|
-
"claude-opus-4-6":{"id":"claude-opus-4-6","name":"Claude Opus 4.6","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25},"contextWindow":200000,"maxTokens":128000},
|
|
13772
|
-
"claude-sonnet-4-0":{"id":"claude-sonnet-4-0","name":"Claude Sonnet 4 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":64000},
|
|
13773
|
-
"claude-sonnet-4-20250514":{"id":"claude-sonnet-4-20250514","name":"Claude Sonnet 4","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":64000},
|
|
13774
|
-
"claude-sonnet-4-5":{"id":"claude-sonnet-4-5","name":"Claude Sonnet 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":64000},
|
|
13775
|
-
"claude-sonnet-4-5-20250929":{"id":"claude-sonnet-4-5-20250929","name":"Claude Sonnet 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":200000,"maxTokens":64000},
|
|
13776
|
-
"claude-sonnet-4-6":{"id":"claude-sonnet-4-6","name":"Claude Sonnet 4.6","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75},"contextWindow":1000000,"maxTokens":64000},
|
|
13745
|
+
"claude-3-5-haiku-20241022":{"id":"claude-3-5-haiku-20241022","name":"Claude Haiku 3.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":0.8,"output":4,"cacheRead":0.08,"cacheWrite":1,"cacheWrite1h":1.6},"contextWindow":200000,"maxTokens":8192},
|
|
13746
|
+
"claude-3-5-haiku-latest":{"id":"claude-3-5-haiku-latest","name":"Claude Haiku 3.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":0.8,"output":4,"cacheRead":0.08,"cacheWrite":1,"cacheWrite1h":1.6},"contextWindow":200000,"maxTokens":8192},
|
|
13747
|
+
"claude-3-5-sonnet-20240620":{"id":"claude-3-5-sonnet-20240620","name":"Claude Sonnet 3.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75,"cacheWrite1h":6},"contextWindow":200000,"maxTokens":8192},
|
|
13748
|
+
"claude-3-5-sonnet-20241022":{"id":"claude-3-5-sonnet-20241022","name":"Claude Sonnet 3.5 v2","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75,"cacheWrite1h":6},"contextWindow":200000,"maxTokens":8192},
|
|
13749
|
+
"claude-3-7-sonnet-20250219":{"id":"claude-3-7-sonnet-20250219","name":"Claude Sonnet 3.7","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75,"cacheWrite1h":6},"contextWindow":200000,"maxTokens":64000},
|
|
13750
|
+
"claude-3-7-sonnet-latest":{"id":"claude-3-7-sonnet-latest","name":"Claude Sonnet 3.7 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75,"cacheWrite1h":6},"contextWindow":200000,"maxTokens":64000},
|
|
13751
|
+
"claude-3-haiku-20240307":{"id":"claude-3-haiku-20240307","name":"Claude Haiku 3","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":0.25,"output":1.25,"cacheRead":0.03,"cacheWrite":0.3,"cacheWrite1h":0.5},"contextWindow":200000,"maxTokens":4096},
|
|
13752
|
+
"claude-3-opus-20240229":{"id":"claude-3-opus-20240229","name":"Claude Opus 3","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75,"cacheWrite1h":30},"contextWindow":200000,"maxTokens":4096},
|
|
13753
|
+
"claude-3-sonnet-20240229":{"id":"claude-3-sonnet-20240229","name":"Claude Sonnet 3","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":0.3,"cacheWrite1h":6},"contextWindow":200000,"maxTokens":4096},
|
|
13754
|
+
"claude-fable-5-1":{"id":"claude-fable-5-1","name":"Claude Fable 5.1","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":10,"output":50,"cacheRead":0.25,"cacheWrite":12.5,"cacheWrite1h":20},"contextWindow":300000,"maxTokens":128000},
|
|
13755
|
+
"claude-sonnet-5-5":{"id":"claude-sonnet-5-5","name":"Claude Sonnet 5.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.1,"cacheWrite":2.5,"cacheWrite1h":4},"contextWindow":1000000,"maxTokens":128000},
|
|
13756
|
+
"claude-opus-5-5":{"id":"claude-opus-5-5","name":"Claude Opus 5.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":4,"output":20,"cacheRead":0.2,"cacheWrite":5,"cacheWrite1h":8},"contextWindow":500000,"maxTokens":128000},
|
|
13757
|
+
"claude-haiku-5-5":{"id":"claude-haiku-5-5","name":"Claude Haiku 5.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":0.1,"output":0.5,"cacheRead":0.01,"cacheWrite":0.125,"cacheWrite1h":0.2},"contextWindow":1000000,"maxTokens":128000},
|
|
13758
|
+
"claude-opus-5":{"id":"claude-opus-5","name":"Claude Opus 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25,"cacheWrite1h":10},"contextWindow":300000,"maxTokens":128000},
|
|
13759
|
+
"claude-sonnet-5":{"id":"claude-sonnet-5","name":"Claude Sonnet 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":2,"output":10,"cacheRead":0.2,"cacheWrite":2.5,"cacheWrite1h":4},"contextWindow":1000000,"maxTokens":128000},
|
|
13760
|
+
"claude-fable-5":{"id":"claude-fable-5","name":"Claude Fable 5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":10,"output":50,"cacheRead":1,"cacheWrite":12.5,"cacheWrite1h":20},"contextWindow":300000,"maxTokens":128000},
|
|
13761
|
+
"claude-opus-4-8":{"id":"claude-opus-4-8","name":"Claude Opus 4.8","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25,"cacheWrite1h":10},"contextWindow":300000,"maxTokens":32000},
|
|
13762
|
+
"claude-opus-4-7":{"id":"claude-opus-4-7","name":"Claude Opus 4.7","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":false,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25,"cacheWrite1h":10},"contextWindow":200000,"maxTokens":32000},
|
|
13763
|
+
"claude-haiku-4-5":{"id":"claude-haiku-4-5","name":"Claude Haiku 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25,"cacheWrite1h":2},"contextWindow":200000,"maxTokens":64000},
|
|
13764
|
+
"claude-haiku-4-5-20251001":{"id":"claude-haiku-4-5-20251001","name":"Claude Haiku 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":1,"output":5,"cacheRead":0.1,"cacheWrite":1.25,"cacheWrite1h":2},"contextWindow":200000,"maxTokens":64000},
|
|
13765
|
+
"claude-opus-4-0":{"id":"claude-opus-4-0","name":"Claude Opus 4 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75,"cacheWrite1h":30},"contextWindow":200000,"maxTokens":32000},
|
|
13766
|
+
"claude-opus-4-1":{"id":"claude-opus-4-1","name":"Claude Opus 4.1 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75,"cacheWrite1h":30},"contextWindow":200000,"maxTokens":32000},
|
|
13767
|
+
"claude-opus-4-1-20250805":{"id":"claude-opus-4-1-20250805","name":"Claude Opus 4.1","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75,"cacheWrite1h":30},"contextWindow":200000,"maxTokens":32000},
|
|
13768
|
+
"claude-opus-4-20250514":{"id":"claude-opus-4-20250514","name":"Claude Opus 4","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":15,"output":75,"cacheRead":1.5,"cacheWrite":18.75,"cacheWrite1h":30},"contextWindow":200000,"maxTokens":32000},
|
|
13769
|
+
"claude-opus-4-5":{"id":"claude-opus-4-5","name":"Claude Opus 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25,"cacheWrite1h":10},"contextWindow":200000,"maxTokens":64000},
|
|
13770
|
+
"claude-opus-4-5-20251101":{"id":"claude-opus-4-5-20251101","name":"Claude Opus 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25,"cacheWrite1h":10},"contextWindow":200000,"maxTokens":64000},
|
|
13771
|
+
"claude-opus-4-6":{"id":"claude-opus-4-6","name":"Claude Opus 4.6","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":5,"output":25,"cacheRead":0.5,"cacheWrite":6.25,"cacheWrite1h":10},"contextWindow":200000,"maxTokens":128000},
|
|
13772
|
+
"claude-sonnet-4-0":{"id":"claude-sonnet-4-0","name":"Claude Sonnet 4 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75,"cacheWrite1h":6},"contextWindow":200000,"maxTokens":64000},
|
|
13773
|
+
"claude-sonnet-4-20250514":{"id":"claude-sonnet-4-20250514","name":"Claude Sonnet 4","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75,"cacheWrite1h":6},"contextWindow":200000,"maxTokens":64000},
|
|
13774
|
+
"claude-sonnet-4-5":{"id":"claude-sonnet-4-5","name":"Claude Sonnet 4.5 (latest)","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75,"cacheWrite1h":6},"contextWindow":200000,"maxTokens":64000},
|
|
13775
|
+
"claude-sonnet-4-5-20250929":{"id":"claude-sonnet-4-5-20250929","name":"Claude Sonnet 4.5","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75,"cacheWrite1h":6},"contextWindow":200000,"maxTokens":64000},
|
|
13776
|
+
"claude-sonnet-4-6":{"id":"claude-sonnet-4-6","name":"Claude Sonnet 4.6","api":"anthropic-messages","provider":"anthropic","baseUrl":"https://api.anthropic.com","reasoning":true,"input":["text","image"],"cost":{"input":3,"output":15,"cacheRead":0.3,"cacheWrite":3.75,"cacheWrite1h":6},"contextWindow":1000000,"maxTokens":64000},
|
|
13777
13777
|
},
|
|
13778
13778
|
"azure-openai-responses": {
|
|
13779
13779
|
"codex-mini-latest":{"id":"codex-mini-latest","name":"Codex Mini","api":"azure-openai-responses","provider":"azure-openai-responses","baseUrl":"","reasoning":true,"input":["text"],"cost":{"input":1.5,"output":6,"cacheRead":0.375,"cacheWrite":0},"contextWindow":200000,"maxTokens":100000},
|
|
@@ -52,12 +52,23 @@ export function getModels(provider) {
|
|
|
52
52
|
const models = modelRegistry.get(provider);
|
|
53
53
|
return models ? Array.from(models.values()) : [];
|
|
54
54
|
}
|
|
55
|
+
// JOHNNESS_PATCH_USAGE_BILLING_91: disjoint token buckets, with native cache TTLs.
|
|
56
|
+
export function johnnessUsageCost(usage, rates) {
|
|
57
|
+
if (!usage || !rates) return undefined;
|
|
58
|
+
const n = v => typeof v === "number" && Number.isFinite(v) && v >= 0 ? v : 0;
|
|
59
|
+
const long = Math.min(n(usage.cacheWrite), n(usage.cacheWrite1h));
|
|
60
|
+
const cost = {
|
|
61
|
+
input: n(usage.input) * rates.input / 1e6,
|
|
62
|
+
output: n(usage.output) * rates.output / 1e6,
|
|
63
|
+
cacheRead: n(usage.cacheRead) * rates.cacheRead / 1e6,
|
|
64
|
+
cacheWrite: ((n(usage.cacheWrite) - long) * rates.cacheWrite + long * (rates.cacheWrite1h ?? rates.input * 2)) / 1e6,
|
|
65
|
+
};
|
|
66
|
+
if (Object.values(cost).some(v => !Number.isFinite(v) || v < 0)) return undefined;
|
|
67
|
+
cost.total = cost.input + cost.output + cost.cacheRead + cost.cacheWrite;
|
|
68
|
+
return cost;
|
|
69
|
+
}
|
|
55
70
|
export function calculateCost(model, usage) {
|
|
56
|
-
usage.cost
|
|
57
|
-
usage.cost.output = (model.cost.output / 1000000) * usage.output;
|
|
58
|
-
usage.cost.cacheRead = (model.cost.cacheRead / 1000000) * usage.cacheRead;
|
|
59
|
-
usage.cost.cacheWrite = (model.cost.cacheWrite / 1000000) * usage.cacheWrite;
|
|
60
|
-
usage.cost.total = usage.cost.input + usage.cost.output + usage.cost.cacheRead + usage.cost.cacheWrite;
|
|
71
|
+
Object.assign(usage.cost, johnnessUsageCost(usage, model.cost));
|
|
61
72
|
return usage.cost;
|
|
62
73
|
}
|
|
63
74
|
/**
|
|
@@ -238,6 +238,13 @@ export const streamAnthropic = (model, context, options) => {
|
|
|
238
238
|
output.usage.output = event.message.usage.output_tokens || 0;
|
|
239
239
|
output.usage.cacheRead = event.message.usage.cache_read_input_tokens || 0;
|
|
240
240
|
output.usage.cacheWrite = event.message.usage.cache_creation_input_tokens || 0;
|
|
241
|
+
// JOHNNESS_PATCH_USAGE_BILLING_91: the response is authoritative for mixed TTLs.
|
|
242
|
+
output.usage.cacheWrite5m = event.message.usage.cache_creation?.ephemeral_5m_input_tokens ?? 0;
|
|
243
|
+
output.usage.cacheWrite1h = event.message.usage.cache_creation?.ephemeral_1h_input_tokens ?? 0;
|
|
244
|
+
if (!event.message.usage.cache_creation) {
|
|
245
|
+
const long = getCacheControl(model.baseUrl, options?.cacheRetention, model.provider).cacheControl?.ttl === "1h";
|
|
246
|
+
output.usage[long ? "cacheWrite1h" : "cacheWrite5m"] = output.usage.cacheWrite;
|
|
247
|
+
}
|
|
241
248
|
// Anthropic doesn't provide total_tokens, compute from components
|
|
242
249
|
output.usage.totalTokens =
|
|
243
250
|
output.usage.input + output.usage.output + output.usage.cacheRead + output.usage.cacheWrite;
|
|
@@ -390,6 +397,14 @@ export const streamAnthropic = (model, context, options) => {
|
|
|
390
397
|
if (event.usage.cache_creation_input_tokens != null) {
|
|
391
398
|
output.usage.cacheWrite = event.usage.cache_creation_input_tokens;
|
|
392
399
|
}
|
|
400
|
+
if (event.usage.cache_creation) {
|
|
401
|
+
output.usage.cacheWrite5m = event.usage.cache_creation.ephemeral_5m_input_tokens ?? 0;
|
|
402
|
+
output.usage.cacheWrite1h = event.usage.cache_creation.ephemeral_1h_input_tokens ?? 0;
|
|
403
|
+
} else if (event.usage.cache_creation_input_tokens != null && output.usage.cacheWrite5m + output.usage.cacheWrite1h !== output.usage.cacheWrite) {
|
|
404
|
+
const long = getCacheControl(model.baseUrl, options?.cacheRetention, model.provider).cacheControl?.ttl === "1h";
|
|
405
|
+
output.usage.cacheWrite5m = long ? 0 : output.usage.cacheWrite;
|
|
406
|
+
output.usage.cacheWrite1h = long ? output.usage.cacheWrite : 0;
|
|
407
|
+
}
|
|
393
408
|
// Anthropic doesn't provide total_tokens, compute from components
|
|
394
409
|
output.usage.totalTokens =
|
|
395
410
|
output.usage.input + output.usage.output + output.usage.cacheRead + output.usage.cacheWrite;
|
|
@@ -156,7 +156,7 @@ export const streamGoogleVertex = (model, context, options) => {
|
|
|
156
156
|
}
|
|
157
157
|
if (chunk.usageMetadata) {
|
|
158
158
|
output.usage = {
|
|
159
|
-
input: chunk.usageMetadata.promptTokenCount || 0,
|
|
159
|
+
input: Math.max(0, (chunk.usageMetadata.promptTokenCount || 0) - (chunk.usageMetadata.cachedContentTokenCount || 0)), // JOHNNESS_PATCH_USAGE_BILLING_91
|
|
160
160
|
output: (chunk.usageMetadata.candidatesTokenCount || 0) + (chunk.usageMetadata.thoughtsTokenCount || 0),
|
|
161
161
|
cacheRead: chunk.usageMetadata.cachedContentTokenCount || 0,
|
|
162
162
|
cacheWrite: 0,
|
|
@@ -182,7 +182,7 @@ export const streamGoogle = (model, context, options) => {
|
|
|
182
182
|
}
|
|
183
183
|
if (chunk.usageMetadata) {
|
|
184
184
|
output.usage = {
|
|
185
|
-
input: chunk.usageMetadata.promptTokenCount || 0,
|
|
185
|
+
input: Math.max(0, (chunk.usageMetadata.promptTokenCount || 0) - (chunk.usageMetadata.cachedContentTokenCount || 0)), // JOHNNESS_PATCH_USAGE_BILLING_91
|
|
186
186
|
output: (chunk.usageMetadata.candidatesTokenCount || 0) + (chunk.usageMetadata.thoughtsTokenCount || 0),
|
|
187
187
|
cacheRead: chunk.usageMetadata.cachedContentTokenCount || 0,
|
|
188
188
|
cacheWrite: 0,
|
|
@@ -105,18 +105,18 @@ export const streamOpenAICompletions = (model, context, options) => {
|
|
|
105
105
|
};
|
|
106
106
|
for await (const chunk of openaiStream) {
|
|
107
107
|
if (chunk.usage) {
|
|
108
|
-
const cachedTokens = chunk.usage.prompt_tokens_details?.cached_tokens
|
|
108
|
+
const cachedTokens = chunk.usage.prompt_tokens_details?.cached_tokens ?? chunk.usage.prompt_cache_hit_tokens ?? 0; // JOHNNESS_PATCH_USAGE_BILLING_91
|
|
109
109
|
const reasoningTokens = chunk.usage.completion_tokens_details?.reasoning_tokens || 0;
|
|
110
|
-
const input = (chunk.usage.prompt_tokens || 0) - cachedTokens;
|
|
111
|
-
|
|
110
|
+
const input = Math.max(0, (chunk.usage.prompt_tokens || 0) - cachedTokens);
|
|
111
|
+
// OpenAI-compatible completion_tokens includes reasoning. Groq reports it separately.
|
|
112
|
+
const outputTokens = (chunk.usage.completion_tokens || 0) + (model.provider === "groq" ? reasoningTokens : 0);
|
|
112
113
|
output.usage = {
|
|
113
114
|
// OpenAI includes cached tokens in prompt_tokens, so subtract to get non-cached input
|
|
114
115
|
input,
|
|
115
116
|
output: outputTokens,
|
|
116
117
|
cacheRead: cachedTokens,
|
|
117
118
|
cacheWrite: 0,
|
|
118
|
-
// Compute totalTokens
|
|
119
|
-
// and some providers (e.g., Groq) don't include them in total_tokens
|
|
119
|
+
// Compute totalTokens from disjoint buckets (Groq reasoning is separate).
|
|
120
120
|
totalTokens: input + outputTokens + cachedTokens,
|
|
121
121
|
cost: {
|
|
122
122
|
input: 0,
|
|
@@ -98,6 +98,8 @@ export interface Usage {
|
|
|
98
98
|
output: number;
|
|
99
99
|
cacheRead: number;
|
|
100
100
|
cacheWrite: number;
|
|
101
|
+
cacheWrite5m?: number;
|
|
102
|
+
cacheWrite1h?: number;
|
|
101
103
|
totalTokens: number;
|
|
102
104
|
cost: {
|
|
103
105
|
input: number;
|
|
@@ -269,6 +271,7 @@ export interface Model<TApi extends Api> {
|
|
|
269
271
|
output: number;
|
|
270
272
|
cacheRead: number;
|
|
271
273
|
cacheWrite: number;
|
|
274
|
+
cacheWrite1h?: number;
|
|
272
275
|
};
|
|
273
276
|
contextWindow: number;
|
|
274
277
|
maxTokens: number;
|
|
@@ -51,6 +51,7 @@ const ModelDefinitionSchema = Type.Object({
|
|
|
51
51
|
output: Type.Number(),
|
|
52
52
|
cacheRead: Type.Number(),
|
|
53
53
|
cacheWrite: Type.Number(),
|
|
54
|
+
cacheWrite1h: Type.Optional(Type.Number({ minimum: 0 })), // JOHNNESS_PATCH_USAGE_BILLING_91
|
|
54
55
|
})),
|
|
55
56
|
contextWindow: Type.Optional(Type.Number()),
|
|
56
57
|
maxTokens: Type.Optional(Type.Number()),
|
|
@@ -67,6 +68,7 @@ const ModelOverrideSchema = Type.Object({
|
|
|
67
68
|
output: Type.Optional(Type.Number()),
|
|
68
69
|
cacheRead: Type.Optional(Type.Number()),
|
|
69
70
|
cacheWrite: Type.Optional(Type.Number()),
|
|
71
|
+
cacheWrite1h: Type.Optional(Type.Number({ minimum: 0 })),
|
|
70
72
|
})),
|
|
71
73
|
contextWindow: Type.Optional(Type.Number()),
|
|
72
74
|
maxTokens: Type.Optional(Type.Number()),
|
|
@@ -137,6 +139,7 @@ function applyModelOverride(model, override) {
|
|
|
137
139
|
output: override.cost.output ?? model.cost.output,
|
|
138
140
|
cacheRead: override.cost.cacheRead ?? model.cost.cacheRead,
|
|
139
141
|
cacheWrite: override.cost.cacheWrite ?? model.cost.cacheWrite,
|
|
142
|
+
...(override.cost.cacheWrite1h !== undefined ? { cacheWrite1h: override.cost.cacheWrite1h } : model.api === "anthropic-messages" && override.cost.input !== undefined ? { cacheWrite1h: override.cost.input * 2 } : model.cost.cacheWrite1h !== undefined ? { cacheWrite1h: model.cost.cacheWrite1h } : {}),
|
|
140
143
|
};
|
|
141
144
|
}
|
|
142
145
|
// Merge headers
|