@wardby/cli 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +22 -3
- package/README.md +11 -9
- package/dist/cli-help.d.ts +1 -1
- package/dist/cli-help.js +1 -0
- package/dist/cli.js +68 -10
- package/dist/coding/base-commit.d.ts +6 -0
- package/dist/coding/base-commit.js +12 -0
- package/dist/coding/protocol.d.ts +17 -1
- package/dist/coding/protocol.js +17 -6
- package/dist/coding/provider.d.ts +6 -1
- package/dist/coding/provider.js +16 -9
- package/dist/config/providers.d.ts +25 -0
- package/dist/config/providers.js +71 -0
- package/dist/core/attribution.d.ts +101 -0
- package/dist/core/attribution.js +208 -0
- package/dist/core/budget-groups.d.ts +17 -10
- package/dist/core/budget-groups.js +15 -12
- package/dist/core/coding-queue.d.ts +3 -0
- package/dist/core/coding-queue.js +6 -2
- package/dist/core/coding-service-status.d.ts +11 -0
- package/dist/core/coding-service-status.js +17 -0
- package/dist/core/cost-report.d.ts +88 -0
- package/dist/core/cost-report.js +248 -0
- package/dist/core/dispatch.d.ts +42 -2
- package/dist/core/dispatch.js +144 -26
- package/dist/core/engine-native.js +17 -4
- package/dist/core/glob.d.ts +10 -0
- package/dist/core/glob.js +33 -0
- package/dist/core/host-events.d.ts +24 -1
- package/dist/core/host-events.js +341 -1
- package/dist/core/host-status.d.ts +19 -2
- package/dist/core/host-status.js +47 -30
- package/dist/core/issue-bridge.d.ts +60 -0
- package/dist/core/issue-bridge.js +189 -0
- package/dist/core/issue-dedupe.d.ts +70 -0
- package/dist/core/issue-dedupe.js +255 -0
- package/dist/core/issue-events.d.ts +42 -0
- package/dist/core/issue-events.js +155 -0
- package/dist/core/issue-status.d.ts +29 -0
- package/dist/core/issue-status.js +241 -0
- package/dist/core/issue-tracker-tools.d.ts +64 -0
- package/dist/core/issue-tracker-tools.js +850 -0
- package/dist/core/model-usage.d.ts +10 -0
- package/dist/core/model-usage.js +24 -0
- package/dist/core/reconciler.d.ts +8 -4
- package/dist/core/reconciler.js +15 -4
- package/dist/core/review-host-tools.js +10 -3
- package/dist/core/run-pricing.d.ts +61 -0
- package/dist/core/run-pricing.js +56 -0
- package/dist/core/runner.d.ts +5 -2
- package/dist/core/runner.js +178 -27
- package/dist/core/scheduler.d.ts +4 -1
- package/dist/core/scheduler.js +3 -2
- package/dist/core/self-defects.d.ts +80 -0
- package/dist/core/self-defects.js +180 -0
- package/dist/core/tool-names.js +3 -0
- package/dist/core/webhooks.d.ts +9 -1
- package/dist/core/webhooks.js +19 -1
- package/dist/env.js +6 -1
- package/dist/generated/prisma/browser.d.ts +66 -0
- package/dist/generated/prisma/client.d.ts +66 -0
- package/dist/generated/prisma/commonInputTypes.d.ts +122 -52
- package/dist/generated/prisma/enums.d.ts +7 -0
- package/dist/generated/prisma/enums.js +6 -0
- package/dist/generated/prisma/internal/class.d.ts +99 -0
- package/dist/generated/prisma/internal/class.js +4 -4
- package/dist/generated/prisma/internal/prismaNamespace.d.ts +826 -1
- package/dist/generated/prisma/internal/prismaNamespace.js +135 -2
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.d.ts +142 -0
- package/dist/generated/prisma/internal/prismaNamespaceBrowser.js +135 -2
- package/dist/generated/prisma/models/Agent.d.ts +389 -1
- package/dist/generated/prisma/models/AgentIssueProject.d.ts +1838 -0
- package/dist/generated/prisma/models/AgentIssueProject.js +1 -0
- package/dist/generated/prisma/models/AgentRepository.d.ts +1 -1
- package/dist/generated/prisma/models/AuthUser.d.ts +1 -1
- package/dist/generated/prisma/models/CodingProxySession.d.ts +73 -1
- package/dist/generated/prisma/models/CodingRun.d.ts +130 -1
- package/dist/generated/prisma/models/CodingRunServiceStatus.d.ts +1404 -0
- package/dist/generated/prisma/models/CodingRunServiceStatus.js +1 -0
- package/dist/generated/prisma/models/IssueFingerprint.d.ts +1183 -0
- package/dist/generated/prisma/models/IssueFingerprint.js +1 -0
- package/dist/generated/prisma/models/IssuePullRequest.d.ts +1255 -0
- package/dist/generated/prisma/models/IssuePullRequest.js +1 -0
- package/dist/generated/prisma/models/ModelCatalogEntry.d.ts +1322 -0
- package/dist/generated/prisma/models/ModelCatalogEntry.js +1 -0
- package/dist/generated/prisma/models/Run.d.ts +933 -1
- package/dist/generated/prisma/models/RunAttribution.d.ts +1259 -0
- package/dist/generated/prisma/models/RunAttribution.js +1 -0
- package/dist/generated/prisma/models/RunIssueStatus.d.ts +1199 -0
- package/dist/generated/prisma/models/RunIssueStatus.js +1 -0
- package/dist/generated/prisma/models/RunModelUsage.d.ts +1316 -0
- package/dist/generated/prisma/models/RunModelUsage.js +1 -0
- package/dist/generated/prisma/models/WorkItem.d.ts +1408 -0
- package/dist/generated/prisma/models/WorkItem.js +1 -0
- package/dist/generated/prisma/models.d.ts +9 -0
- package/dist/help-index.json +355 -16
- package/dist/import/neutral-schema.d.ts +16 -16
- package/dist/knowledge/check.d.ts +13 -0
- package/dist/knowledge/check.js +69 -0
- package/dist/knowledge/cli.d.ts +14 -0
- package/dist/knowledge/cli.js +67 -0
- package/dist/knowledge/concept.d.ts +54 -0
- package/dist/knowledge/concept.js +78 -0
- package/dist/knowledge/note.d.ts +11 -0
- package/dist/knowledge/note.js +39 -0
- package/dist/knowledge/relevance.d.ts +11 -0
- package/dist/knowledge/relevance.js +14 -0
- package/dist/knowledge/span-hash.d.ts +3 -0
- package/dist/knowledge/span-hash.js +16 -0
- package/dist/mcp/auth/access.d.ts +4 -2
- package/dist/mcp/auth/ownership.d.ts +9 -9
- package/dist/mcp/auth/resource-server.d.ts +3 -1
- package/dist/mcp/auth/resource-server.js +18 -3
- package/dist/mcp/auth/self-hosted/credentials.d.ts +3 -3
- package/dist/mcp/auth/self-hosted/session.d.ts +5 -5
- package/dist/mcp/context.d.ts +3 -0
- package/dist/mcp/host-events/deliveries.d.ts +9 -0
- package/dist/mcp/host-events/deliveries.js +17 -0
- package/dist/mcp/host-events/github-ingress.d.ts +4 -2
- package/dist/mcp/host-events/github-ingress.js +4 -13
- package/dist/mcp/host-events/jira-ingress.d.ts +29 -0
- package/dist/mcp/host-events/jira-ingress.js +92 -0
- package/dist/mcp/index.d.ts +2 -0
- package/dist/mcp/index.js +87 -9
- package/dist/mcp/server.js +5 -2
- package/dist/mcp/tools/agents.js +74 -3
- package/dist/mcp/tools/cost-report.d.ts +8 -0
- package/dist/mcp/tools/cost-report.js +60 -0
- package/dist/mcp/tools/issue-projects.d.ts +2 -0
- package/dist/mcp/tools/issue-projects.js +238 -0
- package/dist/mcp/tools/model-catalog.d.ts +22 -0
- package/dist/mcp/tools/model-catalog.js +423 -0
- package/dist/mcp/tools/repositories.js +2 -1
- package/dist/mcp/tools/tools.d.ts +2 -2
- package/dist/mcp/tools/trigger.js +33 -5
- package/dist/mcp/transport/streamable-http.d.ts +5 -0
- package/dist/mcp/transport/streamable-http.js +23 -1
- package/dist/mcp/webhooks/ingress.d.ts +2 -1
- package/dist/mcp/webhooks/ingress.js +9 -2
- package/dist/providers/auth/self-hosted.d.ts +8 -1
- package/dist/providers/auth/self-hosted.js +39 -2
- package/dist/providers/coding-proxy/memory-ledger.d.ts +1 -1
- package/dist/providers/coding-proxy/memory-ledger.js +10 -1
- package/dist/providers/coding-proxy/metering.d.ts +2 -1
- package/dist/providers/coding-proxy/metering.js +13 -2
- package/dist/providers/coding-proxy/prisma-ledger.js +59 -6
- package/dist/providers/coding-proxy/proxy.d.ts +12 -2
- package/dist/providers/coding-proxy/proxy.js +92 -30
- package/dist/providers/coding-proxy/types.d.ts +18 -1
- package/dist/providers/coding-proxy/types.js +12 -1
- package/dist/providers/engine/types.d.ts +19 -0
- package/dist/providers/executor/composition.js +9 -1
- package/dist/providers/executor/container.d.ts +30 -2
- package/dist/providers/executor/container.js +98 -17
- package/dist/providers/executor/dbos.d.ts +2 -0
- package/dist/providers/executor/dbos.js +7 -5
- package/dist/providers/executor/routing.d.ts +6 -0
- package/dist/providers/executor/routing.js +5 -0
- package/dist/providers/executor/types.d.ts +12 -0
- package/dist/providers/issue-tracker/adf.d.ts +31 -0
- package/dist/providers/issue-tracker/adf.js +181 -0
- package/dist/providers/issue-tracker/index.d.ts +5 -0
- package/dist/providers/issue-tracker/index.js +12 -0
- package/dist/providers/issue-tracker/jira-client.d.ts +41 -0
- package/dist/providers/issue-tracker/jira-client.js +151 -0
- package/dist/providers/issue-tracker/jira-events.d.ts +3 -0
- package/dist/providers/issue-tracker/jira-events.js +98 -0
- package/dist/providers/issue-tracker/jira.d.ts +116 -0
- package/dist/providers/issue-tracker/jira.js +502 -0
- package/dist/providers/issue-tracker/types.d.ts +269 -0
- package/dist/providers/issue-tracker/types.js +16 -0
- package/dist/providers/jobs/docker.d.ts +5 -1
- package/dist/providers/jobs/docker.js +61 -33
- package/dist/providers/jobs/kubernetes.d.ts +3 -0
- package/dist/providers/jobs/kubernetes.js +44 -4
- package/dist/providers/jobs/service-state.d.ts +22 -0
- package/dist/providers/jobs/service-state.js +17 -0
- package/dist/providers/llm/anthropic.d.ts +3 -3
- package/dist/providers/llm/anthropic.js +3 -9
- package/dist/providers/llm/bedrock.d.ts +3 -3
- package/dist/providers/llm/bedrock.js +3 -9
- package/dist/providers/llm/catalog-lookup.d.ts +10 -0
- package/dist/providers/llm/catalog-lookup.js +15 -0
- package/dist/providers/llm/catalog-shipped.d.ts +18 -0
- package/dist/providers/llm/catalog-shipped.js +197 -0
- package/dist/providers/llm/catalog-store.d.ts +58 -0
- package/dist/providers/llm/catalog-store.js +138 -0
- package/dist/providers/llm/catalog-types.d.ts +66 -0
- package/dist/providers/llm/catalog-types.js +64 -0
- package/dist/providers/llm/catalog.d.ts +61 -0
- package/dist/providers/llm/catalog.js +147 -0
- package/dist/providers/llm/claude-provider.d.ts +10 -14
- package/dist/providers/llm/claude-provider.js +11 -6
- package/dist/providers/llm/index.d.ts +9 -6
- package/dist/providers/llm/index.js +8 -5
- package/dist/providers/llm/openai.d.ts +14 -5
- package/dist/providers/llm/openai.js +24 -14
- package/dist/providers/llm/pricing-core.d.ts +5 -3
- package/dist/providers/llm/registration.js +8 -12
- package/dist/providers/llm/routing.d.ts +18 -17
- package/dist/providers/llm/routing.js +40 -24
- package/dist/providers/review-host/github-events.js +47 -1
- package/dist/providers/review-host/github.js +7 -6
- package/dist/providers/review-host/types.d.ts +25 -0
- package/dist/providers/vcs/git.js +2 -22
- package/dist/providers/vcs/github.d.ts +20 -0
- package/dist/providers/vcs/github.js +28 -2
- package/dist/providers/vcs/types.d.ts +6 -0
- package/dist/quickstart/index.d.ts +8 -0
- package/dist/quickstart/index.js +34 -34
- package/dist/serve.js +8 -2
- package/dist/viewer/api-schema.d.ts +2757 -0
- package/dist/viewer/api-schema.js +165 -0
- package/dist/viewer/build-schemas.d.ts +2 -0
- package/dist/viewer/build-schemas.js +18 -0
- package/dist/viewer/event-bus.d.ts +38 -0
- package/dist/viewer/event-bus.js +232 -0
- package/dist/viewer/graph.d.ts +40 -0
- package/dist/viewer/graph.js +243 -0
- package/dist/viewer/http.d.ts +30 -0
- package/dist/viewer/http.js +133 -0
- package/dist/viewer/run-detail.d.ts +4 -0
- package/dist/viewer/run-detail.js +61 -0
- package/dist/wardby-bin.js +5 -0
- package/docs/README.md +10 -0
- package/docs/agent-recipes.md +383 -0
- package/docs/code-review-agents.md +29 -2
- package/docs/coding-agent-setup.md +3 -0
- package/docs/coding-worker-isolation.md +39 -5
- package/docs/getting-started-gke.md +28 -11
- package/docs/getting-started-identity-provider.md +49 -38
- package/docs/getting-started.md +14 -0
- package/docs/jira-agents.md +649 -0
- package/docs/knowledge.md +387 -0
- package/docs/models.md +221 -0
- package/docs/security-deployment.md +19 -9
- package/docs/viewer-api.md +142 -0
- package/help/admin-viewer.md +39 -0
- package/help/agent-recipes.md +173 -0
- package/help/architecture-agent.md +189 -0
- package/help/builder-agent.md +80 -0
- package/help/code-review-agents.md +6 -0
- package/help/cost-attribution.md +67 -0
- package/help/creating-agents.md +22 -0
- package/help/deploy-gke.md +6 -0
- package/help/errors/model-unavailable.md +63 -0
- package/help/getting-started.md +1 -0
- package/help/github.md +18 -0
- package/help/identity-and-access.md +8 -3
- package/help/jira.md +135 -0
- package/help/knowledge.md +47 -0
- package/help/models.md +90 -0
- package/help/operating-agents.md +7 -1
- package/help/troubleshooting/budgets.md +6 -0
- package/package.json +5 -2
- package/prisma/migrations/20260930000000_jira_issue_projects/migration.sql +34 -0
- package/prisma/migrations/20261001000000_jira_phase2_allowlists/migration.sql +3 -0
- package/prisma/migrations/20261001010000_jira_link_types_allowlist/migration.sql +2 -0
- package/prisma/migrations/20261002000000_jira_coding_bridge/migration.sql +28 -0
- package/prisma/migrations/20261002010000_jira_issue_creation/migration.sql +25 -0
- package/prisma/migrations/20261003000000_issue_cost_attribution/migration.sql +56 -0
- package/prisma/migrations/20261003010000_coding_run_service_status/migration.sql +23 -0
- package/prisma/migrations/20261003020000_viewer_notify/migration.sql +54 -0
- package/prisma/migrations/20261003030000_viewer_notify_fixes/migration.sql +47 -0
- package/prisma/migrations/20261003040000_viewer_indexes/migration.sql +12 -0
- package/prisma/migrations/20261004000000_model_catalog/migration.sql +26 -0
- package/prisma/schema.prisma +258 -2
- package/dist/mcp/tools/models.d.ts +0 -8
- package/dist/mcp/tools/models.js +0 -15
- package/dist/providers/llm/pricing-anthropic.d.ts +0 -14
- package/dist/providers/llm/pricing-anthropic.js +0 -48
- package/dist/providers/llm/pricing-bedrock-claude.d.ts +0 -20
- package/dist/providers/llm/pricing-bedrock-claude.js +0 -46
- package/dist/providers/llm/pricing.d.ts +0 -30
- package/dist/providers/llm/pricing.js +0 -74
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Anthropic direct-API pricing table. Every entry is a fully literal,
|
|
3
|
-
* hardcoded ModelPricing — every field, including cache read/write, is the
|
|
4
|
-
* provider's own published rate for that exact model, never derived from
|
|
5
|
-
* another field via a ratio (see CLAUDE.md "LLM pricing tables — STRICT": a
|
|
6
|
-
* multiplier that happens to be correct today silently goes stale the
|
|
7
|
-
* moment one model's real cache pricing diverges from the pattern).
|
|
8
|
-
*/
|
|
9
|
-
import { computeCost } from "./pricing-core.js";
|
|
10
|
-
function claude(inputPerMTok, outputPerMTok, cachedInputPerMTok, cacheWritePerMTok) {
|
|
11
|
-
return { encoding: "o200k_base", inputPerMTok, outputPerMTok, cachedInputPerMTok, cacheWritePerMTok };
|
|
12
|
-
}
|
|
13
|
-
// Rates are the exact published 5-minute cache-TTL numbers
|
|
14
|
-
// (platform.claude.com/docs/en/about-claude/pricing, "Model pricing" table)
|
|
15
|
-
// — wardby only ever emits the default 5-minute cache_control breakpoint,
|
|
16
|
-
// so the 1-hour-TTL rates are out of scope and not stored here.
|
|
17
|
-
const PRICING = {
|
|
18
|
-
"claude-opus-5": claude(5, 25, 0.5, 6.25),
|
|
19
|
-
"claude-sonnet-5": claude(2, 10, 0.2, 2.5),
|
|
20
|
-
"claude-fable-5": claude(10, 50, 1, 12.5),
|
|
21
|
-
"claude-haiku-4-5": claude(1, 5, 0.1, 1.25),
|
|
22
|
-
};
|
|
23
|
-
// Reasoning effort levels each model accepts (`output_config.effort`). The
|
|
24
|
-
// single source of truth for direct-API Claude models; a model missing here
|
|
25
|
-
// accepts no effort, so a new roster entry never gets one by accident.
|
|
26
|
-
// Haiku 4.5 rejects the parameter outright.
|
|
27
|
-
const ALL_EFFORTS = ["low", "medium", "high", "xhigh", "max"];
|
|
28
|
-
const EFFORTS = {
|
|
29
|
-
"claude-opus-5": ALL_EFFORTS,
|
|
30
|
-
"claude-sonnet-5": ALL_EFFORTS,
|
|
31
|
-
"claude-fable-5": ALL_EFFORTS,
|
|
32
|
-
"claude-haiku-4-5": [],
|
|
33
|
-
};
|
|
34
|
-
export function anthropicSupportedEfforts(model) {
|
|
35
|
-
return EFFORTS[model] ?? [];
|
|
36
|
-
}
|
|
37
|
-
export function getAnthropicPricing(model) {
|
|
38
|
-
const p = PRICING[model];
|
|
39
|
-
if (!p)
|
|
40
|
-
throw new Error(`No pricing entry for model "${model}" — refusing to price at zero. Add it to src/providers/llm/pricing-anthropic.ts.`);
|
|
41
|
-
return p;
|
|
42
|
-
}
|
|
43
|
-
export function anthropicSupportedModels() {
|
|
44
|
-
return Object.keys(PRICING);
|
|
45
|
-
}
|
|
46
|
-
export function anthropicPriceUsd(model, usage) {
|
|
47
|
-
return computeCost(getAnthropicPricing(model), usage);
|
|
48
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bedrock-Claude pricing table. Every entry is a fully literal, hardcoded
|
|
3
|
-
* ModelPricing — every field, including cache read/write, is the provider's
|
|
4
|
-
* own published rate for that exact model, never derived from another
|
|
5
|
-
* field via a ratio (see CLAUDE.md "LLM pricing tables — STRICT": a
|
|
6
|
-
* multiplier that happens to be correct today silently goes stale the
|
|
7
|
-
* moment one model's real cache pricing diverges from the pattern).
|
|
8
|
-
*/
|
|
9
|
-
import { type ModelPricing, type UsageTokens } from "./pricing-core.js";
|
|
10
|
-
import type { LlmEffort } from "./types.js";
|
|
11
|
-
export declare function getBedrockClaudePricing(model: string): ModelPricing;
|
|
12
|
-
export declare function bedrockClaudeSupportedModels(): string[];
|
|
13
|
-
/**
|
|
14
|
-
* Reasoning effort is not sent through Bedrock: whether InvokeModel accepts
|
|
15
|
-
* the Messages `output_config.effort` field for these models is unconfirmed,
|
|
16
|
-
* and an unaccepted field fails the whole call. Every Bedrock model therefore
|
|
17
|
-
* accepts no effort until that is verified per model.
|
|
18
|
-
*/
|
|
19
|
-
export declare function bedrockClaudeSupportedEfforts(_model: string): readonly LlmEffort[];
|
|
20
|
-
export declare function bedrockClaudePriceUsd(model: string, usage: UsageTokens): number;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bedrock-Claude pricing table. Every entry is a fully literal, hardcoded
|
|
3
|
-
* ModelPricing — every field, including cache read/write, is the provider's
|
|
4
|
-
* own published rate for that exact model, never derived from another
|
|
5
|
-
* field via a ratio (see CLAUDE.md "LLM pricing tables — STRICT": a
|
|
6
|
-
* multiplier that happens to be correct today silently goes stale the
|
|
7
|
-
* moment one model's real cache pricing diverges from the pattern).
|
|
8
|
-
*/
|
|
9
|
-
import { computeCost } from "./pricing-core.js";
|
|
10
|
-
function claude(inputPerMTok, outputPerMTok, cachedInputPerMTok, cacheWritePerMTok) {
|
|
11
|
-
return { encoding: "o200k_base", inputPerMTok, outputPerMTok, cachedInputPerMTok, cacheWritePerMTok };
|
|
12
|
-
}
|
|
13
|
-
// These are `us.` cross-region inference profiles (region us-east-1) — routability
|
|
14
|
-
// is keyed by model ID only; region is a separate adapter concern
|
|
15
|
-
// (BEDROCK_REGION/AWS_REGION). Rates below are the exact published 5-minute
|
|
16
|
-
// cache-TTL numbers (platform.claude.com/docs/en/about-claude/pricing,
|
|
17
|
-
// confirmed 2026-09-08) — this adapter only ever emits the default 5-minute
|
|
18
|
-
// cache_control breakpoint (see claude-messages.ts's withCacheBreakpoints),
|
|
19
|
-
// so the 1-hour-TTL rates are out of scope and not stored here.
|
|
20
|
-
const PRICING = {
|
|
21
|
-
"us.anthropic.claude-sonnet-4-6": claude(3, 15, 0.3, 3.75),
|
|
22
|
-
"us.anthropic.claude-opus-4-6-v1": claude(5, 25, 0.5, 6.25),
|
|
23
|
-
"us.anthropic.claude-opus-4-8": claude(5, 25, 0.5, 6.25),
|
|
24
|
-
"us.anthropic.claude-haiku-4-5-20251001-v1:0": claude(1, 5, 0.1, 1.25),
|
|
25
|
-
};
|
|
26
|
-
export function getBedrockClaudePricing(model) {
|
|
27
|
-
const p = PRICING[model];
|
|
28
|
-
if (!p)
|
|
29
|
-
throw new Error(`No pricing entry for model "${model}" — refusing to price at zero. Add it to src/providers/llm/pricing-bedrock-claude.ts.`);
|
|
30
|
-
return p;
|
|
31
|
-
}
|
|
32
|
-
export function bedrockClaudeSupportedModels() {
|
|
33
|
-
return Object.keys(PRICING);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Reasoning effort is not sent through Bedrock: whether InvokeModel accepts
|
|
37
|
-
* the Messages `output_config.effort` field for these models is unconfirmed,
|
|
38
|
-
* and an unaccepted field fails the whole call. Every Bedrock model therefore
|
|
39
|
-
* accepts no effort until that is verified per model.
|
|
40
|
-
*/
|
|
41
|
-
export function bedrockClaudeSupportedEfforts(_model) {
|
|
42
|
-
return [];
|
|
43
|
-
}
|
|
44
|
-
export function bedrockClaudePriceUsd(model, usage) {
|
|
45
|
-
return computeCost(getBedrockClaudePricing(model), usage);
|
|
46
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Static price + tokenizer table for the budget guardrail.
|
|
3
|
-
*
|
|
4
|
-
* Sourced from OpenAI's public pricing page at write time. Deliberately
|
|
5
|
-
* static (no pricing API call) so `priceUsd` stays synchronous and
|
|
6
|
-
* network-free — the budget math must work offline and in tests. An unknown
|
|
7
|
-
* model throws rather than silently pricing at zero, so a misconfigured
|
|
8
|
-
* agent can never bypass the budget guardrail by accident.
|
|
9
|
-
*
|
|
10
|
-
* `encoding` is here too (not just price) because it drives which
|
|
11
|
-
* `gpt-tokenizer` BPE table `countTokens` uses — every gpt-4o-and-later
|
|
12
|
-
* model uses `o200k_base`, not the older `cl100k_base` gpt-tokenizer
|
|
13
|
-
* defaults to. Keeping both in one table means a model can't be priced
|
|
14
|
-
* without also being told which tokenizer estimates its input cost.
|
|
15
|
-
*
|
|
16
|
-
* `cachedInputPerMTok` / `cacheWritePerMTok` are optional: not every model's
|
|
17
|
-
* entry carries verified cache rates. When a model has cached or
|
|
18
|
-
* cache-write tokens but no rate for them, `priceUsd` falls back to the
|
|
19
|
-
* full (non-cached) input rate — the same fail-toward-overestimate
|
|
20
|
-
* direction as the unknown-model error, never fail-toward-underestimate.
|
|
21
|
-
*/
|
|
22
|
-
import { type ModelPricing, type UsageTokens } from "./pricing-core.js";
|
|
23
|
-
export { computeCost } from "./pricing-core.js";
|
|
24
|
-
export type { ModelPricing, TokenizerEncoding, UsageTokens } from "./pricing-core.js";
|
|
25
|
-
/** Bump whenever a rate changes so durable reservations retain their original terms. */
|
|
26
|
-
export declare const PRICING_VERSION = "2026-09-06";
|
|
27
|
-
/** Looks up a model's pricing/tokenizer entry, or throws (fail closed). */
|
|
28
|
-
export declare function getModelPricing(model: string): ModelPricing;
|
|
29
|
-
export declare function supportedModels(): string[];
|
|
30
|
-
export declare function priceUsd(model: string, usage: UsageTokens): number;
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Static price + tokenizer table for the budget guardrail.
|
|
3
|
-
*
|
|
4
|
-
* Sourced from OpenAI's public pricing page at write time. Deliberately
|
|
5
|
-
* static (no pricing API call) so `priceUsd` stays synchronous and
|
|
6
|
-
* network-free — the budget math must work offline and in tests. An unknown
|
|
7
|
-
* model throws rather than silently pricing at zero, so a misconfigured
|
|
8
|
-
* agent can never bypass the budget guardrail by accident.
|
|
9
|
-
*
|
|
10
|
-
* `encoding` is here too (not just price) because it drives which
|
|
11
|
-
* `gpt-tokenizer` BPE table `countTokens` uses — every gpt-4o-and-later
|
|
12
|
-
* model uses `o200k_base`, not the older `cl100k_base` gpt-tokenizer
|
|
13
|
-
* defaults to. Keeping both in one table means a model can't be priced
|
|
14
|
-
* without also being told which tokenizer estimates its input cost.
|
|
15
|
-
*
|
|
16
|
-
* `cachedInputPerMTok` / `cacheWritePerMTok` are optional: not every model's
|
|
17
|
-
* entry carries verified cache rates. When a model has cached or
|
|
18
|
-
* cache-write tokens but no rate for them, `priceUsd` falls back to the
|
|
19
|
-
* full (non-cached) input rate — the same fail-toward-overestimate
|
|
20
|
-
* direction as the unknown-model error, never fail-toward-underestimate.
|
|
21
|
-
*/
|
|
22
|
-
import { computeCost } from "./pricing-core.js";
|
|
23
|
-
export { computeCost } from "./pricing-core.js";
|
|
24
|
-
/** Bump whenever a rate changes so durable reservations retain their original terms. */
|
|
25
|
-
export const PRICING_VERSION = "2026-09-06";
|
|
26
|
-
const PRICING = {
|
|
27
|
-
"gpt-4o": { encoding: "o200k_base", inputPerMTok: 2.5, cachedInputPerMTok: 1.25, outputPerMTok: 10.0 },
|
|
28
|
-
"gpt-4o-mini": { encoding: "o200k_base", inputPerMTok: 0.15, cachedInputPerMTok: 0.075, outputPerMTok: 0.6 },
|
|
29
|
-
"gpt-4.1": { encoding: "o200k_base", inputPerMTok: 2.0, cachedInputPerMTok: 0.5, outputPerMTok: 8.0 },
|
|
30
|
-
"gpt-4.1-mini": { encoding: "o200k_base", inputPerMTok: 0.4, cachedInputPerMTok: 0.1, outputPerMTok: 1.6 },
|
|
31
|
-
"gpt-4.1-nano": { encoding: "o200k_base", inputPerMTok: 0.1, cachedInputPerMTok: 0.025, outputPerMTok: 0.4 },
|
|
32
|
-
"gpt-6-astra": {
|
|
33
|
-
encoding: "o200k_base",
|
|
34
|
-
inputPerMTok: 10.0,
|
|
35
|
-
cachedInputPerMTok: 1.0,
|
|
36
|
-
cacheWritePerMTok: 12.5,
|
|
37
|
-
outputPerMTok: 50.0,
|
|
38
|
-
},
|
|
39
|
-
"gpt-5.6-sol": {
|
|
40
|
-
encoding: "o200k_base",
|
|
41
|
-
inputPerMTok: 4.0,
|
|
42
|
-
cachedInputPerMTok: 0.4,
|
|
43
|
-
cacheWritePerMTok: 5.0,
|
|
44
|
-
outputPerMTok: 20.0,
|
|
45
|
-
},
|
|
46
|
-
"gpt-5.6-terra": {
|
|
47
|
-
encoding: "o200k_base",
|
|
48
|
-
inputPerMTok: 2.0,
|
|
49
|
-
cachedInputPerMTok: 0.2,
|
|
50
|
-
cacheWritePerMTok: 2.5,
|
|
51
|
-
outputPerMTok: 12.0,
|
|
52
|
-
},
|
|
53
|
-
"gpt-5.6-luna": {
|
|
54
|
-
encoding: "o200k_base",
|
|
55
|
-
inputPerMTok: 0.2,
|
|
56
|
-
cachedInputPerMTok: 0.02,
|
|
57
|
-
cacheWritePerMTok: 0.25,
|
|
58
|
-
outputPerMTok: 1.2,
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
/** Looks up a model's pricing/tokenizer entry, or throws (fail closed). */
|
|
62
|
-
export function getModelPricing(model) {
|
|
63
|
-
const pricing = PRICING[model];
|
|
64
|
-
if (!pricing) {
|
|
65
|
-
throw new Error(`No pricing entry for model "${model}" — refusing to price at zero. ` + `Add it to src/providers/llm/pricing.ts.`);
|
|
66
|
-
}
|
|
67
|
-
return pricing;
|
|
68
|
-
}
|
|
69
|
-
export function supportedModels() {
|
|
70
|
-
return Object.keys(PRICING);
|
|
71
|
-
}
|
|
72
|
-
export function priceUsd(model, usage) {
|
|
73
|
-
return computeCost(getModelPricing(model), usage);
|
|
74
|
-
}
|