UNPKG

@adonis-agora/agent

Version:

Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.

64 lines • 4.26 kB
import type { ModelPriceInput } from '../spi/pricing-store.js'; /** * AWS Bedrock model ids, and what they say about where (and so at what price) a model runs. * * Bedrock reports no cost, so a Bedrock turn is priced off a price row looked up by the id the turn * reports, and that id comes in several shapes for the same model: * * - a base (foundation-model) id: `anthropic.claude-sonnet-4-5-20250929-v1:0` * - a cross-region inference profile: `us.anthropic.…`, `eu.…`, `apac.…`, `us-gov.…`, `global.…` * - an ARN of either: `arn:aws-us-gov:bedrock:us-gov-west-1:123456789012:inference-profile/us-gov.anthropic.…` * * The price also depends on the AWS partition. GovCloud (`aws-us-gov`) and China (`aws-cn`) are not * priced like the commercial regions models.dev lists (GovCloud Claude Sonnet 4.5 costs 20% more), so * a commercial list price must never be applied there silently. */ /** The AWS partitions. Prices in `aws` are what models.dev lists; the others differ. */ export type AwsPartition = 'aws' | 'aws-us-gov' | 'aws-cn'; /** What a Bedrock model id says about itself. */ export interface BedrockModelId { /** The id as given. */ modelId: string; /** The id inside the ARN (or `modelId` when it is no ARN): a profile id or a base id. */ profileId: string; /** The foundation-model id, geo prefix stripped. `undefined` for an application inference profile. */ baseId: string | undefined; /** The cross-region profile's geo prefix (`us`, `us-gov`, `eu`, `global`, …), if any. */ geo: string | undefined; /** The ARN's region, when the id is an ARN that names one. */ region: string | undefined; /** The partition the id implies (ARN partition, region, or `us-gov.` prefix); `undefined` → it does not say. */ partition: AwsPartition | undefined; /** It is an ARN (`arn:aws…:bedrock:…`). */ isArn: boolean; } /** The partition an AWS region belongs to; `undefined` for an empty / missing region. */ export declare function awsPartitionOfRegion(region: string | undefined): AwsPartition | undefined; /** * Parse a Bedrock model id: an ARN (`arn:aws[-us-gov|-cn]:bedrock:<region>:<acct>:(inference-profile| * foundation-model|application-inference-profile)/<id>`), a geo-prefixed inference profile, or a base * id. Returns `undefined` for an id that is not Bedrock-shaped (no ARN, no geo prefix) — a plain * `gpt-4o-mini` is not guessed at. */ export declare function parseBedrockModelId(modelId: string): BedrockModelId | undefined; /** Whether a model is reached through Bedrock: its provider says so, or its id is Bedrock-shaped. */ export declare function isBedrockModel(modelId: string, provider: string | undefined): boolean; /** * The ids to look a Bedrock model's price up under, most specific first: the full id, the profile id * (the ARN's resource), then the base foundation-model id. Deduplicated. A non-Bedrock-shaped id is * its own only candidate. */ export declare function bedrockPriceCandidates(modelId: string): string[]; /** Where the built-in prices below come from, for the log and the docs. */ export declare const BEDROCK_BUILTIN_PRICES_SOURCE = "AWS Price List, us-gov-west-1: AmazonBedrockFoundationModels published 2026-10-08 (Anthropic), AmazonBedrock published 2026-10-06 (Amazon, Meta, OpenAI, NVIDIA, xAI) \u2014 on-demand, standard (in-region) tier, standard context"; /** * Built-in Bedrock prices (USD per 1M tokens) for partitions models.dev does not cover, keyed by base * foundation-model id. Small and curated on purpose — it goes stale, so an app's own * `priceCatalog.prices` (or a row it set) always wins over it. Commercial (`aws`) is not listed: it * comes from models.dev. China (`aws-cn`) bills in CNY and is not covered: such a model is warned * about and left unpriced until the app supplies a price. */ export declare const BEDROCK_BUILTIN_PRICES: Readonly<Partial<Record<AwsPartition, Readonly<Record<string, Omit<ModelPriceInput, 'modelId'>>>>>>; /** The built-in price for a Bedrock model in a non-commercial partition, keyed by `modelId`. */ export declare function builtinBedrockPrice(modelId: string, partition: AwsPartition): ModelPriceInput | undefined; //# sourceMappingURL=bedrock.d.ts.map