Skip to main content
The @mariozechner/pi-ai package provides functions for accessing model metadata and discovering available models.

Import

getModel

Get a specific model by provider and model ID.
KnownProvider
required
Provider name (e.g., "anthropic", "openai", "google")
string
required
Model ID (e.g., "claude-4.5-sonnet-20250514", "gpt-5.3-codex")
object

Example

getModels

Get all models for a specific provider.
KnownProvider
required
Provider name
Returns an array of all models from the specified provider.

Example

getProviders

Get all available providers.
Returns an array of all registered provider names.

Example

calculateCost

Calculate the cost for a given usage.
Model
required
The model used
Usage
required
Token usage object
Returns the cost breakdown with input, output, cacheRead, cacheWrite, and total in USD.

Example

supportsXhigh

Check if a model supports "xhigh" thinking level.
Model
required
The model to check
Returns true if the model supports "xhigh" thinking (GPT-5.2/5.3 and Opus 4.6).

Example

modelsAreEqual

Check if two models are the same.
Compares both id and provider fields. Returns false if either model is null/undefined.

Example

Known Providers

The following providers are built into Pi:
  • "anthropic" - Anthropic Claude models
  • "openai" - OpenAI GPT models
  • "google" - Google Gemini models
  • "google-vertex" - Google Vertex AI
  • "google-gemini-cli" - Google Gemini CLI
  • "amazon-bedrock" - AWS Bedrock
  • "xai" - xAI Grok models
  • "groq" - Groq
  • "cerebras" - Cerebras
  • "openrouter" - OpenRouter
  • "github-copilot" - GitHub Copilot
  • "mistral" - Mistral AI
  • "minimax" - MiniMax
  • "huggingface" - Hugging Face

Model Capabilities

Models may have the following capabilities:
  • "tools" - Supports function calling
  • "vision" - Supports image inputs
  • "thinking" - Supports extended reasoning
  • "streaming" - Supports streaming responses