@agentgazer/shared
v0.5.4
Published
Shared types, schemas, and utilities for AgentGazer packages
Maintainers
Readme
@agentgazer/shared
Shared types, schemas, and utilities used by all AgentGazer packages.
Contents
Types and schemas
AgentEvent/AgentEventSchema— Zod-validated event schema with fields for provider, model, tokens, cost, latency, trace IDs, and tagsBatchEvents/BatchEventsSchema— Wrapper for event arraysEventType—llm_call,completion,heartbeat,error,customSource—sdk,proxy
Provider detection
detectProvider(url)— Detects the LLM provider from a URL (returnsopenai,anthropic,google,mistral,deepseek, orunknown)getProviderBaseUrl(provider)— Returns the base API URL for a provider
Response parsing
parseProviderResponse(provider, body, statusCode)— Extracts model, token counts, and errors from provider-specific JSON response formats
Pricing
calculateCost(model, tokensIn, tokensOut)— Calculates USD cost for a known modelgetModelPricing(model)— Returns per-million-token pricinglistSupportedModels()— Lists all models with known pricing
Logging
createLogger(component)— Creates a structured logger withdebug,info,warn,errormethods. Outputs JSON in production, pretty-printed text in development.
License
Apache-2.0