JSPM

@f3d1/llmkit-shared

0.0.6
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 18
  • Score
    100M100P100Q54961F
  • License MIT

Shared types, pricing data, and constants for LLMKit packages

Package Exports

  • @f3d1/llmkit-shared

Readme

@f3d1/llmkit-shared

Shared types, constants, and pricing data for LLMKit packages.

What's in it

  • TypeScript types: LLMRequest, LLMResponse, CostBreakdown, TokenUsage, ProviderName, Budget, and more
  • Pricing table: per-token costs for 11 providers (OpenAI, Anthropic, Gemini, Groq, Together, Fireworks, DeepSeek, Mistral, xAI, Ollama, OpenRouter) and 700+ models, including cache read/write rates where applicable
  • Cost calculation: calculateCost(), calculateCostBreakdown(), getModelPricing()
  • Provider inference: inferProvider() resolves a model name to its provider
  • Error types: shared error definitions across LLMKit packages

Install

npm install @f3d1/llmkit-shared

Usage

import { calculateCost, inferProvider, getModelPricing } from '@f3d1/llmkit-shared';

const cost = calculateCost('anthropic', 'claude-sonnet-4-6', 1000, 500);
// -> 0.0105 (USD)

const provider = inferProvider('gpt-4.1');
// -> 'openai'

const pricing = getModelPricing('openai', 'gpt-4.1');
// -> { inputPerMillion: 2.0, outputPerMillion: 8.0 }

Docs

Full documentation: github.com/smigolsmigol/llmkit

License

MIT