modelrig 0.11.0 → 0.12.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 +82 -0
- package/dist/adapters/anthropic.d.ts +4 -4
- package/dist/adapters/anthropic.d.ts.map +1 -1
- package/dist/adapters/anthropic.js +8 -1
- package/dist/adapters/deepseek.d.ts +2 -4
- package/dist/adapters/deepseek.d.ts.map +1 -1
- package/dist/adapters/deepseek.js +9 -5
- package/dist/adapters/gemini.d.ts +4 -1
- package/dist/adapters/gemini.d.ts.map +1 -1
- package/dist/adapters/gemini.js +16 -1
- package/dist/adapters/grok.d.ts +2 -4
- package/dist/adapters/grok.d.ts.map +1 -1
- package/dist/adapters/grok.js +8 -4
- package/dist/adapters/history-mapping.d.ts +126 -0
- package/dist/adapters/history-mapping.d.ts.map +1 -0
- package/dist/adapters/history-mapping.js +230 -0
- package/dist/adapters/openai-compat.d.ts +2 -4
- package/dist/adapters/openai-compat.d.ts.map +1 -1
- package/dist/adapters/openai-compat.js +9 -5
- package/dist/adapters/openai.d.ts +2 -4
- package/dist/adapters/openai.d.ts.map +1 -1
- package/dist/adapters/openai.js +8 -4
- package/dist/adapters/responses-api.d.ts.map +1 -1
- package/dist/adapters/responses-api.js +9 -4
- package/dist/artifacts/artifact.d.ts.map +1 -1
- package/dist/artifacts/artifact.js +79 -0
- package/dist/artifacts/conversation.d.ts +128 -0
- package/dist/artifacts/conversation.d.ts.map +1 -0
- package/dist/artifacts/conversation.js +172 -0
- package/dist/artifacts/index.d.ts +1 -1
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/media.d.ts +46 -0
- package/dist/artifacts/media.d.ts.map +1 -0
- package/dist/artifacts/media.js +88 -0
- package/dist/artifacts/run-context.d.ts +61 -2
- package/dist/artifacts/run-context.d.ts.map +1 -1
- package/dist/artifacts/run-context.js +183 -12
- package/dist/artifacts/scrub.d.ts +3 -0
- package/dist/artifacts/scrub.d.ts.map +1 -1
- package/dist/bakeoff/engine.d.ts.map +1 -1
- package/dist/bakeoff/engine.js +34 -7
- package/dist/bakeoff/eval-cases.d.ts +5 -0
- package/dist/bakeoff/eval-cases.d.ts.map +1 -1
- package/dist/bakeoff/eval-cases.js +10 -1
- package/dist/bakeoff/replay.d.ts +15 -0
- package/dist/bakeoff/replay.d.ts.map +1 -1
- package/dist/bakeoff/replay.js +19 -1
- package/dist/bakeoff/report.d.ts.map +1 -1
- package/dist/bakeoff/report.js +9 -2
- package/dist/bakeoff/turn-replay.d.ts +93 -0
- package/dist/bakeoff/turn-replay.d.ts.map +1 -0
- package/dist/bakeoff/turn-replay.js +150 -0
- package/dist/bakeoff/types.d.ts +12 -0
- package/dist/bakeoff/types.d.ts.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -0
- package/dist/config.d.ts +18 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +23 -3
- package/dist/doctor-preflight.d.ts.map +1 -1
- package/dist/doctor-preflight.js +6 -1
- package/dist/feedback/grade.d.ts +7 -2
- package/dist/feedback/grade.d.ts.map +1 -1
- package/dist/feedback/grade.js +14 -0
- package/dist/feedback/outcome.d.ts +103 -0
- package/dist/feedback/outcome.d.ts.map +1 -0
- package/dist/feedback/outcome.js +175 -0
- package/dist/gateway/history-bridge.d.ts +32 -0
- package/dist/gateway/history-bridge.d.ts.map +1 -0
- package/dist/gateway/history-bridge.js +64 -0
- package/dist/gateway/serve-client.d.ts.map +1 -1
- package/dist/gateway/serve-client.js +6 -0
- package/dist/index.d.ts +44 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +110 -9
- package/dist/init/init-cli.d.ts.map +1 -1
- package/dist/init/init-cli.js +21 -4
- package/dist/init/observe-cli.js +1 -1
- package/dist/init/observe.d.ts +7 -1
- package/dist/init/observe.d.ts.map +1 -1
- package/dist/init/observe.js +74 -22
- package/dist/init/starter.d.ts +36 -0
- package/dist/init/starter.d.ts.map +1 -0
- package/dist/init/starter.js +85 -0
- package/dist/registry/build.d.ts +4 -0
- package/dist/registry/build.d.ts.map +1 -1
- package/dist/registry/generation-models.d.ts +68 -0
- package/dist/registry/generation-models.d.ts.map +1 -0
- package/dist/registry/generation-models.js +168 -0
- package/dist/registry/model-kind.d.ts +34 -0
- package/dist/registry/model-kind.d.ts.map +1 -0
- package/dist/registry/model-kind.js +40 -0
- package/dist/registry/pricing-shape.d.ts +29 -1
- package/dist/registry/pricing-shape.d.ts.map +1 -1
- package/dist/registry/pricing-shape.js +9 -0
- package/dist/registry/pricing.d.ts +26 -0
- package/dist/registry/pricing.d.ts.map +1 -1
- package/dist/registry/pricing.js +29 -0
- package/dist/registry/rows.d.ts.map +1 -1
- package/dist/registry/rows.js +3 -1
- package/dist/registry/unit-pricing.d.ts +32 -0
- package/dist/registry/unit-pricing.d.ts.map +1 -0
- package/dist/registry/unit-pricing.js +62 -0
- package/dist/routes/input-loader.d.ts +38 -0
- package/dist/routes/input-loader.d.ts.map +1 -0
- package/dist/routes/input-loader.js +80 -0
- package/dist/routes/loader.d.ts.map +1 -1
- package/dist/routes/loader.js +3 -0
- package/dist/routes/resolved-bundle.d.ts +2 -0
- package/dist/routes/resolved-bundle.d.ts.map +1 -1
- package/dist/routes/resolved-bundle.js +3 -0
- package/dist/run/cost.d.ts +28 -0
- package/dist/run/cost.d.ts.map +1 -1
- package/dist/run/cost.js +74 -0
- package/dist/run/dispatch.d.ts +4 -1
- package/dist/run/dispatch.d.ts.map +1 -1
- package/dist/run/dispatch.js +3 -0
- package/dist/run/limits.d.ts +88 -0
- package/dist/run/limits.d.ts.map +1 -0
- package/dist/run/limits.js +155 -0
- package/dist/run/messages.d.ts +199 -0
- package/dist/run/messages.d.ts.map +1 -0
- package/dist/run/messages.js +430 -0
- package/dist/run/raw-finalize.d.ts +5 -2
- package/dist/run/raw-finalize.d.ts.map +1 -1
- package/dist/run/raw-finalize.js +8 -5
- package/dist/run/raw-request.d.ts.map +1 -1
- package/dist/run/raw-request.js +2 -1
- package/dist/run/raw.d.ts +10 -4
- package/dist/run/raw.d.ts.map +1 -1
- package/dist/run/raw.js +11 -3
- package/dist/run/rawonly.d.ts +29 -5
- package/dist/run/rawonly.d.ts.map +1 -1
- package/dist/run/rawonly.js +54 -19
- package/dist/run/record-attempt.d.ts.map +1 -1
- package/dist/run/record-attempt.js +16 -6
- package/dist/run/record-call.d.ts +13 -2
- package/dist/run/record-call.d.ts.map +1 -1
- package/dist/run/record-call.js +50 -7
- package/dist/run/run.d.ts.map +1 -1
- package/dist/run/run.js +12 -8
- package/dist/telemetry/attempt-meta.d.ts +49 -1
- package/dist/telemetry/attempt-meta.d.ts.map +1 -1
- package/dist/telemetry/attempt-meta.js +45 -1
- package/dist/telemetry/exporter.d.ts.map +1 -1
- package/dist/telemetry/exporter.js +2 -1
- package/dist/telemetry/grade-mappers.d.ts +1 -1
- package/dist/telemetry/grade-mappers.d.ts.map +1 -1
- package/dist/telemetry/grade-mappers.js +7 -1
- package/dist/telemetry/grade-task.d.ts +49 -0
- package/dist/telemetry/grade-task.d.ts.map +1 -0
- package/dist/telemetry/grade-task.js +85 -0
- package/dist/telemetry/grades-sql.d.ts +16 -1
- package/dist/telemetry/grades-sql.d.ts.map +1 -1
- package/dist/telemetry/grades-sql.js +64 -4
- package/dist/telemetry/ingest-protocol.d.ts +24 -1
- package/dist/telemetry/ingest-protocol.d.ts.map +1 -1
- package/dist/telemetry/ingest-protocol.js +72 -43
- package/dist/telemetry/otel-content.d.ts +31 -0
- package/dist/telemetry/otel-content.d.ts.map +1 -0
- package/dist/telemetry/otel-content.js +106 -0
- package/dist/telemetry/otel-hierarchy.d.ts +57 -0
- package/dist/telemetry/otel-hierarchy.d.ts.map +1 -0
- package/dist/telemetry/otel-hierarchy.js +155 -0
- package/dist/telemetry/otel-normalize.d.ts +15 -1
- package/dist/telemetry/otel-normalize.d.ts.map +1 -1
- package/dist/telemetry/otel-normalize.js +24 -39
- package/dist/telemetry/sinks.d.ts +4 -1
- package/dist/telemetry/sinks.d.ts.map +1 -1
- package/dist/telemetry/sinks.js +53 -34
- package/dist/telemetry/store-migrations.d.ts.map +1 -1
- package/dist/telemetry/store-migrations.js +8 -0
- package/dist/telemetry/store.d.ts +9 -0
- package/dist/telemetry/store.d.ts.map +1 -1
- package/dist/telemetry/store.js +10 -0
- package/dist/telemetry/uniform-rows.d.ts +43 -0
- package/dist/telemetry/uniform-rows.d.ts.map +1 -0
- package/dist/telemetry/uniform-rows.js +139 -0
- package/dist/types/failures-teaching.d.ts.map +1 -1
- package/dist/types/failures-teaching.js +11 -0
- package/dist/types/failures.d.ts +1 -1
- package/dist/types/failures.d.ts.map +1 -1
- package/dist/types/failures.js +2 -0
- package/dist/types/provider.d.ts +12 -0
- package/dist/types/provider.d.ts.map +1 -1
- package/dist/types/route.d.ts +13 -0
- package/dist/types/route.d.ts.map +1 -1
- package/dist/types/telemetry.d.ts +14 -1
- package/dist/types/telemetry.d.ts.map +1 -1
- package/docs/agent-skill/SKILL.md +122 -12
- package/docs/how-it-fits.md +4 -4
- package/docs/instrumentation.md +148 -44
- package/docs/llms.txt +143 -13
- package/docs/mcp-oracle.md +15 -4
- package/docs/quickstart.md +129 -16
- package/package.json +4 -2
- package/registry/registry.json +456 -0
- package/templates/creative-approval.json +81 -0
- package/templates/support-conversation.json +82 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* The starter route's companion files (SURF-1, audit #2). Every on-ramp shows
|
|
4
|
+
* the same starter route, `example.support_summarize` (console
|
|
5
|
+
* STARTER_ROUTE_YAML, www /get-started, quickstart §3), and that YAML references
|
|
6
|
+
* `./schemas/support_summarize.schema.json` and
|
|
7
|
+
* `./prompts/support_summarize.system.md`. Neither shipped in the npm tarball,
|
|
8
|
+
* so a customer who pasted the route got "schema file not found" from
|
|
9
|
+
* `modelrig validate`. `modelrig init` now writes both next to the routes dir
|
|
10
|
+
* (never clobbering), and `surf1-setup.test.ts` asserts these constants equal the
|
|
11
|
+
* package's own committed example files and that the starter validates.
|
|
12
|
+
*
|
|
13
|
+
* They are support files, not routes: the loader reads only top-level *.yaml,
|
|
14
|
+
* so writing them can never change what a rig serves.
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.STARTER_PROMPT_MD = exports.STARTER_SCHEMA_JSON = exports.STARTER_PROMPT_PATH = exports.STARTER_SCHEMA_PATH = void 0;
|
|
18
|
+
exports.writeStarterFiles = writeStarterFiles;
|
|
19
|
+
/** Path of each companion file, relative to the routes directory. */
|
|
20
|
+
exports.STARTER_SCHEMA_PATH = "schemas/support_summarize.schema.json";
|
|
21
|
+
exports.STARTER_PROMPT_PATH = "prompts/support_summarize.system.md";
|
|
22
|
+
exports.STARTER_SCHEMA_JSON = `{
|
|
23
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
24
|
+
"title": "support_summarize",
|
|
25
|
+
"type": "object",
|
|
26
|
+
"additionalProperties": false,
|
|
27
|
+
"required": ["summary", "handoff"],
|
|
28
|
+
"properties": {
|
|
29
|
+
"summary": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"minLength": 40,
|
|
32
|
+
"description": "One paragraph a human agent can act on without reading the thread."
|
|
33
|
+
},
|
|
34
|
+
"severity": { "type": "string", "enum": ["low", "normal", "high", "urgent"] },
|
|
35
|
+
"handoff": {
|
|
36
|
+
"type": "object",
|
|
37
|
+
"additionalProperties": false,
|
|
38
|
+
"required": ["team", "reason"],
|
|
39
|
+
"properties": {
|
|
40
|
+
"team": { "type": "string", "enum": ["billing", "technical", "account", "none"] },
|
|
41
|
+
"reason": { "type": "string", "minLength": 10 }
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
`;
|
|
47
|
+
exports.STARTER_PROMPT_MD = `You summarise a customer support ticket for the agent who picks it up next.
|
|
48
|
+
|
|
49
|
+
Product: {{product}}
|
|
50
|
+
|
|
51
|
+
Earlier context on this customer (may be "none"):
|
|
52
|
+
{{priorContext}}
|
|
53
|
+
|
|
54
|
+
Ticket:
|
|
55
|
+
{{ticket}}
|
|
56
|
+
|
|
57
|
+
Write one actionable paragraph, judge severity, and name the team it should go
|
|
58
|
+
to (or \`none\` if the summary closes it).
|
|
59
|
+
|
|
60
|
+
{{#unless capability.structured_native}}
|
|
61
|
+
Return ONLY a JSON object matching this shape — no prose, no code fence:
|
|
62
|
+
{"summary": string, "severity": "low"|"normal"|"high"|"urgent",
|
|
63
|
+
"handoff": {"team": "billing"|"technical"|"account"|"none", "reason": string}}
|
|
64
|
+
{{/unless}}
|
|
65
|
+
`;
|
|
66
|
+
/** Write the starter's schema and prompt under `routesDir`, leaving any file that
|
|
67
|
+
* already exists alone (it is the customer's). Returns what was written/skipped. */
|
|
68
|
+
function writeStarterFiles(routesDir, fs, path) {
|
|
69
|
+
const written = [];
|
|
70
|
+
const skipped = [];
|
|
71
|
+
for (const [rel, body] of [
|
|
72
|
+
[exports.STARTER_SCHEMA_PATH, exports.STARTER_SCHEMA_JSON],
|
|
73
|
+
[exports.STARTER_PROMPT_PATH, exports.STARTER_PROMPT_MD],
|
|
74
|
+
]) {
|
|
75
|
+
const file = path.join(routesDir, rel);
|
|
76
|
+
if (fs.existsSync(file)) {
|
|
77
|
+
skipped.push(file);
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
81
|
+
fs.writeFileSync(file, body, "utf8");
|
|
82
|
+
written.push(file);
|
|
83
|
+
}
|
|
84
|
+
return { written, skipped };
|
|
85
|
+
}
|
package/dist/registry/build.d.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { ModelFacts } from "./claims";
|
|
11
11
|
import type { ModelPricingV2 } from "./pricing-shape";
|
|
12
|
+
import type { ModelKind } from "./model-kind";
|
|
12
13
|
export interface DeclaredLayer {
|
|
13
14
|
readonly as_of: string;
|
|
14
15
|
readonly source: string;
|
|
@@ -168,6 +169,9 @@ export interface Discrepancy {
|
|
|
168
169
|
}
|
|
169
170
|
export interface RegistryEntry {
|
|
170
171
|
readonly model_key: string;
|
|
172
|
+
/** ARC-4 (ARC-D5): absent ⇒ `llm`. Any other kind is a DECLARED-ONLY
|
|
173
|
+
* generation model — unprobed and never ranked (model-kind.ts). */
|
|
174
|
+
readonly kind?: ModelKind;
|
|
171
175
|
readonly declared: DeclaredLayer | null;
|
|
172
176
|
readonly probed: ProbedLayer | null;
|
|
173
177
|
readonly observed: ObservedLayer | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/registry/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/registry/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAC3C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;QACpC,QAAQ,CAAC,mBAAmB,EAAE,MAAM,CAAC;QACrC,QAAQ,CAAC,yBAAyB,EAAE,MAAM,GAAG,IAAI,CAAC;KACnD,GAAG,IAAI,CAAC;IACT;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,CAAC,E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E,eAAe,GAAG,kBAAkB,CAchF;AAED;;;;;;;yEAOyE;AACzE,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,SAAS,eAAe,EAAE,EACnC,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAAC,GACrC,eAAe,GAAG,SAAS,CA4B7B;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,SAAS,eAAe,EAAE,EACnC,uBAAuB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GAC5C,WAAW,GAAG,IAAI,CAuBpB;AAED;4EAC4E;AAC5E,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,aAAa,GAAG,IAAI,EAC9B,MAAM,EAAE,WAAW,GAAG,IAAI,GACzB,WAAW,EAAE,CA4Gf;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,aAAa,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;IACxC,QAAQ,CAAC,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAC;CACzC,CAAC,EACF,WAAW,EAAE,MAAM,GAClB,QAAQ,CAgBV;AAED;;qDAEqD;AACrD,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,mBAAmB,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAG9F"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ARC-4 (ARC-D5) — DECLARED-ONLY generation models in the registry.
|
|
3
|
+
*
|
|
4
|
+
* A short, reviewed list of widely used image / video / text-to-speech /
|
|
5
|
+
* speech-to-text models whose UNIT price we can source. Every price is READ
|
|
6
|
+
* from the vendored LiteLLM snapshot (data/pricing-map.json at the pinned SHA)
|
|
7
|
+
* by {@link buildGenerationLayer} — never typed in by hand — and carries its
|
|
8
|
+
* provenance: the snapshot key, the field, and the upstream pricing page when
|
|
9
|
+
* the snapshot names one. A model whose snapshot entry has no usable unit rate
|
|
10
|
+
* gets NO price (honest absence), not a guess (L5).
|
|
11
|
+
*
|
|
12
|
+
* These entries are:
|
|
13
|
+
* - declared-only and UNPROBED (no probe suite measures generation quality);
|
|
14
|
+
* - NEVER ranked: `kind` ≠ `llm` keeps them out of RigIndex, the leaderboard,
|
|
15
|
+
* capability selection and the console mirror (model-kind.ts `isRankable`,
|
|
16
|
+
* pinned by rank-wall-kind.test.ts);
|
|
17
|
+
* - observed only through `rig.recordCall({ units })` — no adapter exists.
|
|
18
|
+
*
|
|
19
|
+
* Output: registry/layers/generation.json (build-generation.ts writes it;
|
|
20
|
+
* build-registry.ts merges it). Pure — the snapshot is passed in.
|
|
21
|
+
*/
|
|
22
|
+
import type { DeclaredLayer, RegistryEntry } from "./build";
|
|
23
|
+
import type { GenerationKind } from "./model-kind";
|
|
24
|
+
import type { GenerationPricingV2 } from "./pricing-shape";
|
|
25
|
+
/** The pinned snapshot this layer reads (upstream/litellm.pin.json). */
|
|
26
|
+
export declare const GENERATION_SNAPSHOT: {
|
|
27
|
+
readonly sha: "de706a35a6";
|
|
28
|
+
readonly pinnedDate: "2026-07-30";
|
|
29
|
+
};
|
|
30
|
+
/** The reviewed list: registry model_key → the snapshot key its price is read
|
|
31
|
+
* from. Adding a model is a reviewed edit HERE; the price follows the source. */
|
|
32
|
+
export declare const GENERATION_SOURCES: ReadonlyArray<{
|
|
33
|
+
readonly modelKey: string;
|
|
34
|
+
readonly mapKey: string;
|
|
35
|
+
}>;
|
|
36
|
+
/** One layer row: the kind + the declared block. */
|
|
37
|
+
export interface GenerationLayerEntry {
|
|
38
|
+
readonly kind: GenerationKind;
|
|
39
|
+
readonly declared: Omit<DeclaredLayer, "pricing_v2"> & {
|
|
40
|
+
readonly pricing_v2: GenerationPricingV2 | null;
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export type GenerationLayer = Readonly<Record<string, GenerationLayerEntry>>;
|
|
44
|
+
/** A registry entry for a generation model (RegistryEntry with a kind and the
|
|
45
|
+
* generation price block). */
|
|
46
|
+
export type GenerationRegistryEntry = Omit<RegistryEntry, "declared"> & {
|
|
47
|
+
readonly kind: GenerationKind;
|
|
48
|
+
readonly declared: GenerationLayerEntry["declared"];
|
|
49
|
+
};
|
|
50
|
+
interface SnapshotEntry {
|
|
51
|
+
readonly mode?: string;
|
|
52
|
+
readonly source?: string;
|
|
53
|
+
readonly [key: string]: unknown;
|
|
54
|
+
}
|
|
55
|
+
/** Build the generation layer from the snapshot. Throws on a source key the
|
|
56
|
+
* snapshot does not carry or whose mode is not a generation mode — a reviewed
|
|
57
|
+
* list entry that no longer resolves must fail the build, not vanish. */
|
|
58
|
+
export declare function buildGenerationLayer(snapshot: Readonly<Record<string, SnapshotEntry>>): GenerationLayer;
|
|
59
|
+
/** The layer as registry entries (no probed/observed layer, no notes/facts). */
|
|
60
|
+
export declare function generationRegistryEntries(layer: GenerationLayer): GenerationRegistryEntry[];
|
|
61
|
+
/** Merge the generation entries into a registry's model list: any existing
|
|
62
|
+
* entry with the same key is REPLACED (the layer is the source of truth for
|
|
63
|
+
* these keys), and the list stays sorted by model_key like buildRegistry. */
|
|
64
|
+
export declare function mergeGenerationEntries<T extends {
|
|
65
|
+
readonly model_key: string;
|
|
66
|
+
}>(models: readonly T[], layer: GenerationLayer): Array<T | GenerationRegistryEntry>;
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=generation-models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generation-models.d.ts","sourceRoot":"","sources":["../../src/registry/generation-models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,mB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AsB,CAAC,CAAC,SAAS;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;CAAE,EAC7E,MAAM,EAAE,SAAS,CAAC,EAAE,EACpB,KAAK,EAAE,eAAe,GACrB,KAAK,CAAC,CAAC,GAAG,uBAAuB,CAAC,CAKpC"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ARC-4 (ARC-D5) — DECLARED-ONLY generation models in the registry.
|
|
4
|
+
*
|
|
5
|
+
* A short, reviewed list of widely used image / video / text-to-speech /
|
|
6
|
+
* speech-to-text models whose UNIT price we can source. Every price is READ
|
|
7
|
+
* from the vendored LiteLLM snapshot (data/pricing-map.json at the pinned SHA)
|
|
8
|
+
* by {@link buildGenerationLayer} — never typed in by hand — and carries its
|
|
9
|
+
* provenance: the snapshot key, the field, and the upstream pricing page when
|
|
10
|
+
* the snapshot names one. A model whose snapshot entry has no usable unit rate
|
|
11
|
+
* gets NO price (honest absence), not a guess (L5).
|
|
12
|
+
*
|
|
13
|
+
* These entries are:
|
|
14
|
+
* - declared-only and UNPROBED (no probe suite measures generation quality);
|
|
15
|
+
* - NEVER ranked: `kind` ≠ `llm` keeps them out of RigIndex, the leaderboard,
|
|
16
|
+
* capability selection and the console mirror (model-kind.ts `isRankable`,
|
|
17
|
+
* pinned by rank-wall-kind.test.ts);
|
|
18
|
+
* - observed only through `rig.recordCall({ units })` — no adapter exists.
|
|
19
|
+
*
|
|
20
|
+
* Output: registry/layers/generation.json (build-generation.ts writes it;
|
|
21
|
+
* build-registry.ts merges it). Pure — the snapshot is passed in.
|
|
22
|
+
*/
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.GENERATION_SOURCES = exports.GENERATION_SNAPSHOT = void 0;
|
|
25
|
+
exports.buildGenerationLayer = buildGenerationLayer;
|
|
26
|
+
exports.generationRegistryEntries = generationRegistryEntries;
|
|
27
|
+
exports.mergeGenerationEntries = mergeGenerationEntries;
|
|
28
|
+
/** The pinned snapshot this layer reads (upstream/litellm.pin.json). */
|
|
29
|
+
exports.GENERATION_SNAPSHOT = { sha: "de706a35a6", pinnedDate: "2026-07-30" };
|
|
30
|
+
/** The reviewed list: registry model_key → the snapshot key its price is read
|
|
31
|
+
* from. Adding a model is a reviewed edit HERE; the price follows the source. */
|
|
32
|
+
exports.GENERATION_SOURCES = [
|
|
33
|
+
{ modelKey: "openai/dall-e-3", mapKey: "dall-e-3" },
|
|
34
|
+
{ modelKey: "gemini/imagen-4.0-generate-001", mapKey: "gemini/imagen-4.0-generate-001" },
|
|
35
|
+
{ modelKey: "gemini/imagen-4.0-fast-generate-001", mapKey: "gemini/imagen-4.0-fast-generate-001" },
|
|
36
|
+
{ modelKey: "black_forest_labs/flux-pro-1.1", mapKey: "black_forest_labs/flux-pro-1.1" },
|
|
37
|
+
{ modelKey: "stability/sd3.5-large", mapKey: "stability/sd3.5-large" },
|
|
38
|
+
{ modelKey: "gemini/veo-3.1-generate-preview", mapKey: "gemini/veo-3.1-generate-preview" },
|
|
39
|
+
{ modelKey: "gemini/veo-3.1-fast-generate-preview", mapKey: "gemini/veo-3.1-fast-generate-preview" },
|
|
40
|
+
{ modelKey: "openai/sora-2", mapKey: "sora-2" },
|
|
41
|
+
{ modelKey: "openai/tts-1", mapKey: "tts-1" },
|
|
42
|
+
{ modelKey: "elevenlabs/eleven_multilingual_v2", mapKey: "elevenlabs/eleven_multilingual_v2" },
|
|
43
|
+
{ modelKey: "openai/whisper-1", mapKey: "whisper-1" },
|
|
44
|
+
{ modelKey: "deepgram/nova-3", mapKey: "deepgram/nova-3" },
|
|
45
|
+
];
|
|
46
|
+
const MODE_KIND = {
|
|
47
|
+
image_generation: "image_gen",
|
|
48
|
+
video_generation: "video_gen",
|
|
49
|
+
audio_speech: "tts",
|
|
50
|
+
audio_transcription: "stt",
|
|
51
|
+
};
|
|
52
|
+
function rate(v) {
|
|
53
|
+
return typeof v === "number" && Number.isFinite(v) && v > 0 ? v : null;
|
|
54
|
+
}
|
|
55
|
+
/** Strip binary float noise (0.000015 × 1e6 = 15.000000000000002). */
|
|
56
|
+
function clean(n) {
|
|
57
|
+
return Number(n.toPrecision(12));
|
|
58
|
+
}
|
|
59
|
+
/** The billed unit rate the snapshot publishes for this mode, as
|
|
60
|
+
* {modality field, value, snapshot field}. Mirrors pricing.ts getMapUnitRates. */
|
|
61
|
+
function unitRateOf(e) {
|
|
62
|
+
switch (e.mode) {
|
|
63
|
+
case "image_generation": {
|
|
64
|
+
const out = rate(e.output_cost_per_image);
|
|
65
|
+
if (out !== null)
|
|
66
|
+
return { field: "image_per_unit", value: out, from: "output_cost_per_image" };
|
|
67
|
+
const inp = rate(e.input_cost_per_image);
|
|
68
|
+
return inp !== null ? { field: "image_per_unit", value: inp, from: "input_cost_per_image" } : null;
|
|
69
|
+
}
|
|
70
|
+
case "video_generation": {
|
|
71
|
+
const pv = rate(e.output_cost_per_video_per_second);
|
|
72
|
+
if (pv !== null)
|
|
73
|
+
return { field: "video_per_second", value: pv, from: "output_cost_per_video_per_second" };
|
|
74
|
+
const ps = rate(e.output_cost_per_second);
|
|
75
|
+
return ps !== null ? { field: "video_per_second", value: ps, from: "output_cost_per_second" } : null;
|
|
76
|
+
}
|
|
77
|
+
case "audio_speech": {
|
|
78
|
+
const pc = rate(e.input_cost_per_character);
|
|
79
|
+
if (pc !== null)
|
|
80
|
+
return { field: "characters_per_million", value: clean(pc * 1000000), from: "input_cost_per_character" };
|
|
81
|
+
const ps = rate(e.output_cost_per_second);
|
|
82
|
+
return ps !== null ? { field: "audio_per_second", value: ps, from: "output_cost_per_second" } : null;
|
|
83
|
+
}
|
|
84
|
+
case "audio_transcription": {
|
|
85
|
+
const ps = rate(e.input_cost_per_second);
|
|
86
|
+
return ps !== null ? { field: "audio_per_second", value: ps, from: "input_cost_per_second" } : null;
|
|
87
|
+
}
|
|
88
|
+
default:
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const BASIS = {
|
|
93
|
+
image_gen: "per generated image · as filed under the snapshot key · declared-only (unprobed)",
|
|
94
|
+
video_gen: "per second of generated video · as filed under the snapshot key · declared-only (unprobed)",
|
|
95
|
+
tts: "per input character (shown per 1M) · as filed under the snapshot key · declared-only (unprobed)",
|
|
96
|
+
stt: "per second of input audio · as filed under the snapshot key · declared-only (unprobed)",
|
|
97
|
+
};
|
|
98
|
+
const NULL_FLAGS = {
|
|
99
|
+
supports_response_schema: null,
|
|
100
|
+
supports_web_search: null,
|
|
101
|
+
supports_prompt_caching: null,
|
|
102
|
+
adapter_structured_native: null,
|
|
103
|
+
adapter_grounded_native: null,
|
|
104
|
+
supports_image_input: null,
|
|
105
|
+
};
|
|
106
|
+
/** Build the generation layer from the snapshot. Throws on a source key the
|
|
107
|
+
* snapshot does not carry or whose mode is not a generation mode — a reviewed
|
|
108
|
+
* list entry that no longer resolves must fail the build, not vanish. */
|
|
109
|
+
function buildGenerationLayer(snapshot) {
|
|
110
|
+
const out = {};
|
|
111
|
+
const asOf = exports.GENERATION_SNAPSHOT.pinnedDate;
|
|
112
|
+
for (const { modelKey, mapKey } of exports.GENERATION_SOURCES) {
|
|
113
|
+
const e = snapshot[mapKey];
|
|
114
|
+
if (e === undefined)
|
|
115
|
+
throw new Error(`generation source ${modelKey}: snapshot key "${mapKey}" not found`);
|
|
116
|
+
const kind = typeof e.mode === "string" ? MODE_KIND[e.mode] : undefined;
|
|
117
|
+
if (kind === undefined)
|
|
118
|
+
throw new Error(`generation source ${modelKey}: snapshot mode "${String(e.mode)}" is not a generation mode`);
|
|
119
|
+
const upstream = typeof e.source === "string" && /^https?:\/\//.test(e.source) ? ` (upstream: ${e.source})` : "";
|
|
120
|
+
const unit = unitRateOf(e);
|
|
121
|
+
const source = unit !== null
|
|
122
|
+
? `litellm-pricing-map@${exports.GENERATION_SNAPSHOT.sha} key "${mapKey}" mode ${e.mode} field ${unit.from}${upstream}`
|
|
123
|
+
: `litellm-pricing-map@${exports.GENERATION_SNAPSHOT.sha} key "${mapKey}" — no unit rate published (unpriced)`;
|
|
124
|
+
const pricingV2 = unit === null
|
|
125
|
+
? null
|
|
126
|
+
: {
|
|
127
|
+
base: null,
|
|
128
|
+
tiers: null,
|
|
129
|
+
context_bands: null,
|
|
130
|
+
batch_discount: null,
|
|
131
|
+
modality: { [unit.field]: unit.value, provenance: { source, as_of: asOf } },
|
|
132
|
+
source,
|
|
133
|
+
as_of: asOf,
|
|
134
|
+
basis: BASIS[kind],
|
|
135
|
+
};
|
|
136
|
+
out[modelKey] = {
|
|
137
|
+
kind,
|
|
138
|
+
declared: {
|
|
139
|
+
as_of: asOf,
|
|
140
|
+
source: `declared-only generation model (unprobed, never ranked) · ${source}`,
|
|
141
|
+
pricing: null,
|
|
142
|
+
pricing_v2: pricingV2,
|
|
143
|
+
flags: NULL_FLAGS,
|
|
144
|
+
},
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
return out;
|
|
148
|
+
}
|
|
149
|
+
/** The layer as registry entries (no probed/observed layer, no notes/facts). */
|
|
150
|
+
function generationRegistryEntries(layer) {
|
|
151
|
+
return Object.entries(layer).map(([modelKey, row]) => ({
|
|
152
|
+
model_key: modelKey,
|
|
153
|
+
kind: row.kind,
|
|
154
|
+
declared: row.declared,
|
|
155
|
+
probed: null,
|
|
156
|
+
observed: null,
|
|
157
|
+
discrepancies: [],
|
|
158
|
+
callNotes: [],
|
|
159
|
+
facts: null,
|
|
160
|
+
}));
|
|
161
|
+
}
|
|
162
|
+
/** Merge the generation entries into a registry's model list: any existing
|
|
163
|
+
* entry with the same key is REPLACED (the layer is the source of truth for
|
|
164
|
+
* these keys), and the list stays sorted by model_key like buildRegistry. */
|
|
165
|
+
function mergeGenerationEntries(models, layer) {
|
|
166
|
+
const keys = new Set(Object.keys(layer));
|
|
167
|
+
return [...models.filter((m) => !keys.has(m.model_key)), ...generationRegistryEntries(layer)].sort((a, b) => a.model_key < b.model_key ? -1 : 1);
|
|
168
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ARC-4 (ARC-D5) — the registry `kind` vocabulary. An entry without `kind` is an
|
|
3
|
+
* `llm` (the implicit default — every entry before ARC-γ). The other kinds are
|
|
4
|
+
* DECLARED-ONLY generation models: unprobed, never ranked, priced per unit
|
|
5
|
+
* (images, seconds, characters) rather than per token, and observed only through
|
|
6
|
+
* `rig.recordCall({ units })` — ModelRig ships no adapter for them.
|
|
7
|
+
*
|
|
8
|
+
* PURE and import-free on purpose: the RigIndex / leaderboard builders import it
|
|
9
|
+
* to keep non-`llm` kinds out of rank, and their import closure is walled
|
|
10
|
+
* (rigindex-wall.test.ts).
|
|
11
|
+
*/
|
|
12
|
+
export declare const MODEL_KINDS: readonly ["llm", "image_gen", "video_gen", "tts", "stt"];
|
|
13
|
+
export type ModelKind = (typeof MODEL_KINDS)[number];
|
|
14
|
+
/** The generation kinds (everything but `llm`). */
|
|
15
|
+
export type GenerationKind = Exclude<ModelKind, "llm">;
|
|
16
|
+
export declare function isModelKind(v: unknown): v is ModelKind;
|
|
17
|
+
/** An entry's kind: its declared `kind`, else `llm`. An unrecognized value is
|
|
18
|
+
* treated as NOT `llm` (fail-closed: it can never sneak into rank). */
|
|
19
|
+
export declare function kindOf(entry: {
|
|
20
|
+
readonly kind?: unknown;
|
|
21
|
+
}): ModelKind | "unknown";
|
|
22
|
+
/** THE rank wall predicate: only an `llm` entry may enter RigIndex, the
|
|
23
|
+
* leaderboard, or capability selection. */
|
|
24
|
+
export declare function isRankable(entry: {
|
|
25
|
+
readonly kind?: unknown;
|
|
26
|
+
}): boolean;
|
|
27
|
+
/** The model keys of every non-rankable entry in a registry model list — the
|
|
28
|
+
* set the RigIndex builder refuses (its inputs are probe files, not registry
|
|
29
|
+
* entries, so it is handed the keys). */
|
|
30
|
+
export declare function nonRankableKeys(models: ReadonlyArray<{
|
|
31
|
+
readonly model_key: string;
|
|
32
|
+
readonly kind?: unknown;
|
|
33
|
+
}>): Set<string>;
|
|
34
|
+
//# sourceMappingURL=model-kind.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-kind.d.ts","sourceRoot":"","sources":["../../src/registry/model-kind.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,eAAO,MAAM,WAAW,0DAA2D,CAAC;AACpF,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD,mDAAmD;AACnD,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,SAAS,EAAE,KAAK,CAAC,CAAC;AAEvD,wBAAgB,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,SAAS,CAEtD;AAED;uEACuE;AACvE,wBAAgB,MAAM,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,SAAS,GAAG,SAAS,CAGhF;AAED;2CAC2C;AAC3C,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAEtE;AAED;;yCAEyC;AACzC,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,CAAC;IAAE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAE3H"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ARC-4 (ARC-D5) — the registry `kind` vocabulary. An entry without `kind` is an
|
|
4
|
+
* `llm` (the implicit default — every entry before ARC-γ). The other kinds are
|
|
5
|
+
* DECLARED-ONLY generation models: unprobed, never ranked, priced per unit
|
|
6
|
+
* (images, seconds, characters) rather than per token, and observed only through
|
|
7
|
+
* `rig.recordCall({ units })` — ModelRig ships no adapter for them.
|
|
8
|
+
*
|
|
9
|
+
* PURE and import-free on purpose: the RigIndex / leaderboard builders import it
|
|
10
|
+
* to keep non-`llm` kinds out of rank, and their import closure is walled
|
|
11
|
+
* (rigindex-wall.test.ts).
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.MODEL_KINDS = void 0;
|
|
15
|
+
exports.isModelKind = isModelKind;
|
|
16
|
+
exports.kindOf = kindOf;
|
|
17
|
+
exports.isRankable = isRankable;
|
|
18
|
+
exports.nonRankableKeys = nonRankableKeys;
|
|
19
|
+
exports.MODEL_KINDS = ["llm", "image_gen", "video_gen", "tts", "stt"];
|
|
20
|
+
function isModelKind(v) {
|
|
21
|
+
return typeof v === "string" && exports.MODEL_KINDS.includes(v);
|
|
22
|
+
}
|
|
23
|
+
/** An entry's kind: its declared `kind`, else `llm`. An unrecognized value is
|
|
24
|
+
* treated as NOT `llm` (fail-closed: it can never sneak into rank). */
|
|
25
|
+
function kindOf(entry) {
|
|
26
|
+
if (entry.kind === undefined || entry.kind === null)
|
|
27
|
+
return "llm";
|
|
28
|
+
return isModelKind(entry.kind) ? entry.kind : "unknown";
|
|
29
|
+
}
|
|
30
|
+
/** THE rank wall predicate: only an `llm` entry may enter RigIndex, the
|
|
31
|
+
* leaderboard, or capability selection. */
|
|
32
|
+
function isRankable(entry) {
|
|
33
|
+
return kindOf(entry) === "llm";
|
|
34
|
+
}
|
|
35
|
+
/** The model keys of every non-rankable entry in a registry model list — the
|
|
36
|
+
* set the RigIndex builder refuses (its inputs are probe files, not registry
|
|
37
|
+
* entries, so it is handed the keys). */
|
|
38
|
+
function nonRankableKeys(models) {
|
|
39
|
+
return new Set(models.filter((m) => !isRankable(m)).map((m) => m.model_key));
|
|
40
|
+
}
|
|
@@ -84,10 +84,28 @@ export type ImageInputPrice = {
|
|
|
84
84
|
readonly source: string;
|
|
85
85
|
readonly as_of: string;
|
|
86
86
|
};
|
|
87
|
-
/**
|
|
87
|
+
/** Where a modality block's UNIT rates came from (ARC-4). REQUIRED for any of
|
|
88
|
+
* `image_per_unit` / `audio_per_second` / `video_per_second` /
|
|
89
|
+
* `characters_per_million` to be priced: a unit rate with no provenance is
|
|
90
|
+
* never used (L5 — absent beats guessed). */
|
|
91
|
+
export interface UnitRateProvenance {
|
|
92
|
+
readonly source: string;
|
|
93
|
+
readonly as_of: string;
|
|
94
|
+
}
|
|
95
|
+
/** Non-token units, USD per unit. For an `llm` entry these are INPUT units (an
|
|
96
|
+
* image or a second of audio sent in); for a declared generation model
|
|
97
|
+
* (registry `kind` image_gen | video_gen | tts | stt — ARC-4) they are what the
|
|
98
|
+
* call is billed in: images generated, seconds produced (video/tts) or
|
|
99
|
+
* transcribed (stt), characters synthesized. */
|
|
88
100
|
export interface ModalityRates {
|
|
89
101
|
readonly image_per_unit?: number | null;
|
|
90
102
|
readonly audio_per_second?: number | null;
|
|
103
|
+
/** ARC-4: USD per second of generated video. */
|
|
104
|
+
readonly video_per_second?: number | null;
|
|
105
|
+
/** ARC-4: USD per MILLION characters (TTS input text). */
|
|
106
|
+
readonly characters_per_million?: number | null;
|
|
107
|
+
/** ARC-4: provenance for the unit rates above (see {@link UnitRateProvenance}). */
|
|
108
|
+
readonly provenance?: UnitRateProvenance | null;
|
|
91
109
|
/** Typed, provenance-bearing image-input price (UC-3 M0). Additive and
|
|
92
110
|
* optional; absent when the vendor's image price could not be sourced —
|
|
93
111
|
* absence is honest, never a zero or a guess. Supersedes the bare
|
|
@@ -169,4 +187,14 @@ export interface PricingV2Display {
|
|
|
169
187
|
* guarantee lives here, in code, so no consumer can bypass it.
|
|
170
188
|
*/
|
|
171
189
|
export declare function describePricingV2(pricing: ModelPricingV2): PricingV2Display;
|
|
190
|
+
/**
|
|
191
|
+
* ARC-4: the price block of a DECLARED-ONLY generation model (registry `kind`
|
|
192
|
+
* other than `llm`). Same shape as {@link ModelPricingV2} except `base` is
|
|
193
|
+
* null: these models publish no per-token rate, and a placeholder `0` would be
|
|
194
|
+
* read as "$0 per token" by anything that reads the registry (L5). The price is
|
|
195
|
+
* the `modality` unit rates, with their provenance.
|
|
196
|
+
*/
|
|
197
|
+
export interface GenerationPricingV2 extends Omit<ModelPricingV2, "base"> {
|
|
198
|
+
readonly base: null;
|
|
199
|
+
}
|
|
172
200
|
//# sourceMappingURL=pricing-shape.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pricing-shape.d.ts","sourceRoot":"","sources":["../../src/registry/pricing-shape.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+BAA+B;IAC/B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,uEAAuE;IACvE,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC;kFAC8E;IAC9E,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,0EAA0E;IAC1E,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC;AAED;2EAC2E;AAC3E,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,wBAAwB,CAAC;AAE/D,8DAA8D;AAC9D,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,QAAQ,CAAC,EAAE,cAAc,GAAG,IAAI,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Q,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAqBD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,GAAG,gBAAgB,CAyD3E;AASD;;;;;;GAMG;AACH,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,cAAc,EAAE,MAAM,CAAC;IACvE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;CACrB"}
|
|
@@ -142,6 +142,7 @@ function describePricingV2(pricing) {
|
|
|
142
142
|
if (pricing.modality?.audio_per_second != null) {
|
|
143
143
|
modality.push(`audio: $${pricing.modality.audio_per_second.toFixed(4)} per second`);
|
|
144
144
|
}
|
|
145
|
+
pushGenerationRates(modality, pricing.modality ?? null);
|
|
145
146
|
const urlMatch = URL_RE.exec(pricing.source);
|
|
146
147
|
return {
|
|
147
148
|
basis: pricing.basis,
|
|
@@ -158,3 +159,11 @@ function describePricingV2(pricing) {
|
|
|
158
159
|
vendorUrl: urlMatch ? urlMatch[0] : null,
|
|
159
160
|
};
|
|
160
161
|
}
|
|
162
|
+
/** ARC-4: the generation unit rates (video seconds, TTS characters), rendered
|
|
163
|
+
* only when present — honest absence otherwise. */
|
|
164
|
+
function pushGenerationRates(out, m) {
|
|
165
|
+
if (m?.video_per_second != null)
|
|
166
|
+
out.push(`video: $${m.video_per_second.toFixed(4)} per second`);
|
|
167
|
+
if (m?.characters_per_million != null)
|
|
168
|
+
out.push(`text-to-speech: $${m.characters_per_million.toFixed(2)} per 1M characters`);
|
|
169
|
+
}
|
|
@@ -41,4 +41,30 @@ export declare function estimateCostUsd(pricing: ModelPricing, tokensIn: number,
|
|
|
41
41
|
tokensCacheWrite?: number,
|
|
42
42
|
/** 1h-TTL portion of the write (bills at the higher multiplier when known). */
|
|
43
43
|
tokensCacheWrite1h?: number): number;
|
|
44
|
+
/**
|
|
45
|
+
* ARC-4: the per-unit rates the vendored LiteLLM snapshot publishes for a
|
|
46
|
+
* GENERATION model, read by mode (LiteLLM spells the same unit differently per
|
|
47
|
+
* mode, so the mode decides which key is the billed unit — nothing is summed or
|
|
48
|
+
* inferred across keys):
|
|
49
|
+
* - `image_generation`: USD per generated image = `output_cost_per_image`,
|
|
50
|
+
* else `input_cost_per_image` (LiteLLM files OpenAI's per-image price there).
|
|
51
|
+
* - `video_generation`: USD per second = `output_cost_per_video_per_second`,
|
|
52
|
+
* else `output_cost_per_second`.
|
|
53
|
+
* - `audio_speech` (TTS): USD per character = `input_cost_per_character`;
|
|
54
|
+
* USD per second of produced audio = `output_cost_per_second` (billed only
|
|
55
|
+
* when the entry has no per-character rate — one billed unit per model).
|
|
56
|
+
* - `audio_transcription` (STT): USD per second of input audio =
|
|
57
|
+
* `input_cost_per_second` (the snapshot's `output_cost_per_second` on some STT
|
|
58
|
+
* entries is not a billed unit and is ignored).
|
|
59
|
+
* Any other mode (chat, embedding, …) has NO unit price here. Key resolution:
|
|
60
|
+
* a known provider's own prefixes, then `<provider>/<model>`.
|
|
61
|
+
*/
|
|
62
|
+
export interface MapUnitRates {
|
|
63
|
+
readonly key: string;
|
|
64
|
+
readonly mode: string;
|
|
65
|
+
readonly perImage: number | null;
|
|
66
|
+
readonly perSecond: number | null;
|
|
67
|
+
readonly perCharacter: number | null;
|
|
68
|
+
}
|
|
69
|
+
export declare function getMapUnitRates(provider: string, model: string): MapUnitRates | null;
|
|
44
70
|
//# sourceMappingURL=pricing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pricing.d.ts","sourceRoot":"","sources":["../../src/registry/pricing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,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AAE,MAAM;AACpB;;;0CAG0C;AAC1C,gBAAgB,SAAI;AACpB,+EAA+E;AAC/E,kBAAkB,SAAI,GACrB,MAAM,CAsBR;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CACtC;AAMD,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAsBpF"}
|
package/dist/registry/pricing.js
CHANGED
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
13
13
|
exports.getPricing = getPricing;
|
|
14
14
|
exports.getPricingV2 = getPricingV2;
|
|
15
15
|
exports.estimateCostUsd = estimateCostUsd;
|
|
16
|
+
exports.getMapUnitRates = getMapUnitRates;
|
|
16
17
|
const node_fs_1 = require("node:fs");
|
|
17
18
|
const node_path_1 = require("node:path");
|
|
18
19
|
/** LiteLLM key prefixes per provider, most-specific first. Verified against
|
|
@@ -129,3 +130,31 @@ tokensCacheWrite1h = 0) {
|
|
|
129
130
|
write1h * write1hRate +
|
|
130
131
|
Math.max(tokensOut, 0) * pricing.outputUsdPerTok);
|
|
131
132
|
}
|
|
133
|
+
function finiteRate(v) {
|
|
134
|
+
return typeof v === "number" && Number.isFinite(v) && v >= 0 ? v : null;
|
|
135
|
+
}
|
|
136
|
+
function getMapUnitRates(provider, model) {
|
|
137
|
+
if (provider === "" || model === "")
|
|
138
|
+
return null;
|
|
139
|
+
const map = loadMap();
|
|
140
|
+
const prefixes = KEY_PREFIXES[provider] ?? [];
|
|
141
|
+
const candidates = [...prefixes.map((p) => `${p}${model}`), `${provider}/${model}`];
|
|
142
|
+
for (const key of candidates) {
|
|
143
|
+
const e = map[key];
|
|
144
|
+
if (e === undefined || typeof e.mode !== "string")
|
|
145
|
+
continue;
|
|
146
|
+
switch (e.mode) {
|
|
147
|
+
case "image_generation":
|
|
148
|
+
return { key, mode: e.mode, perImage: finiteRate(e.output_cost_per_image) ?? finiteRate(e.input_cost_per_image), perSecond: null, perCharacter: null };
|
|
149
|
+
case "video_generation":
|
|
150
|
+
return { key, mode: e.mode, perImage: null, perSecond: finiteRate(e.output_cost_per_video_per_second) ?? finiteRate(e.output_cost_per_second), perCharacter: null };
|
|
151
|
+
case "audio_speech":
|
|
152
|
+
return { key, mode: e.mode, perImage: null, perSecond: finiteRate(e.output_cost_per_second), perCharacter: finiteRate(e.input_cost_per_character) };
|
|
153
|
+
case "audio_transcription":
|
|
154
|
+
return { key, mode: e.mode, perImage: null, perSecond: finiteRate(e.input_cost_per_second), perCharacter: null };
|
|
155
|
+
default:
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../../src/registry/rows.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../../src/registry/rows.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AA4C/C;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,cAAc,EAAE,CA6BxE"}
|