@adonis-agora/agent
Version:
Governed, durable-backed AI agent (chat + tool-calling + governance) for AdonisJS — part of the Agora ecosystem.
54 lines • 3.47 kB
TypeScript
import type { AgentPricingStore, ModelPriceInput } from '../spi/pricing-store.js';
/** O endereço do catálogo. Aberto, sem chave, JSON único. */
export declare const MODELS_DEV_URL = "https://models.dev/api.json";
export interface ModelsDevOptions {
/** Sobrescreve a URL do catálogo (um espelho interno, um arquivo em disco servido por você). */
url?: string;
/** `fetch` alternativo. Existe para os testes não irem à rede, e para quem precisa de proxy. */
fetch?: typeof globalThis.fetch;
signal?: AbortSignal;
}
/** Um modelo no catálogo: `'<provider>/<model>'`, por exemplo `'openai/gpt-4o-mini'`. */
export type ModelsDevRef = string;
/** The result of a lenient lookup: what the catalog priced, and what it did not. */
export interface ModelsDevLookup {
prices: ModelPriceInput[];
/** Refs with no entry, or an entry without an input/output price. */
missing: ModelsDevRef[];
}
/**
* The lenient twin of {@link fetchModelsDevPrices}, for boot-time seeding: a model the catalog does
* not price is reported in `missing` instead of failing the whole batch, so one unknown model does
* not leave every other one unpriced. Throws only when the catalog itself cannot be read.
*
* Each ref is a LIST of candidates, tried in order — the first one the catalog prices wins.
*/
export declare function lookupModelsDevPrices(refs: readonly (readonly ModelsDevRef[])[], options?: ModelsDevOptions): Promise<ModelsDevLookup>;
/**
* {@link lookupModelsDevPrices}, one result per element of `refs` (in order): the price the first
* pricing candidate yields, or `undefined`. For callers that key the row themselves.
*/
export declare function lookupModelsDevPricesEach(refs: readonly (readonly ModelsDevRef[])[], options?: ModelsDevOptions): Promise<(ModelPriceInput | undefined)[]>;
/**
* The models.dev refs to try for a model, most specific first: `<provider>/<modelId>`, then — for an
* OpenRouter-style id (`deepseek/deepseek-v4.1-flash`) reached through another SDK — the OpenRouter
* list price. `provider` is the AI SDK provider family (`openrouter`, `openai`, `vercel`, …).
*
* A Bedrock id is normalized first (see `parseBedrockModelId`): an ARN or a geo-prefixed inference
* profile is tried as the full id, the profile id, then the base foundation-model id — all under
* `amazon-bedrock`. An ARN is never tried as an OpenRouter id (its `/` is not a vendor separator), nor
* looked up verbatim (models.dev lists no ARNs).
*/
export declare function modelsDevRefsFor(modelId: string, provider: string | undefined): ModelsDevRef[];
export declare function fetchModelsDevPrices(models: readonly ModelsDevRef[], options?: ModelsDevOptions): Promise<ModelPriceInput[]>;
/**
* Busca no models.dev e grava no store. O atalho de uma linha para um comando de seed.
*
* Deliberadamente NÃO tem retry, cache nem modo silencioso: isto é para rodar num comando de
* operador (ou num passo de deploy), onde uma falha deve aparecer e parar, e não para rodar no
* caminho de uma request. Preço é dado que muda de mês em mês, não de segundo em segundo — buscar
* na hora de cobrar seria trocar uma tabela que você controla por uma dependência de rede de
* terceiro no meio da sua contabilidade.
*/
export declare function seedPricesFromModelsDev(store: AgentPricingStore, models: readonly ModelsDevRef[], options?: ModelsDevOptions): Promise<ModelPriceInput[]>;
//# sourceMappingURL=models-dev.d.ts.map