@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
Example
getProviders
Get all available providers.Example
calculateCost
Calculate the cost for a given usage.Model
required
The model used
Usage
required
Token usage object
input, output, cacheRead, cacheWrite, and total in USD.
Example
supportsXhigh
Check if a model supports"xhigh" thinking level.
Model
required
The model to check
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.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