npm install ./sdk/javascriptRun from the repository root after cloning. ESM, CommonJS, and TypeScript declarations are included.
Source SDKs
Use the checked-in JavaScript, TypeScript, and Python clients for the AI Pricing Hub REST API and MCP server. The SDKs are read-only, typed, retry-capable, and configurable for future authentication.
Installation
The SDK source packages are included in the AI Pricing Hub repository under /sdk/javascript and /sdk/python. They are not currently published to npm or PyPI, so install from the checked-out source path or use the public REST API directly.
npm install ./sdk/javascriptRun from the repository root after cloning. ESM, CommonJS, and TypeScript declarations are included.
python -m pip install ./sdk/pythonRun from the repository root after cloning. Type hints and py.typed are included.
Quick Start
import { AIPricingHubClient } from "@aipricinghub/sdk";
const client = new AIPricingHubClient();
const models = await client.searchModels({ query: "gpt", provider: "openai" });from aipricinghub import AIPricingHubClient
client = AIPricingHubClient()
models = client.search_models(query="gpt", provider="openai")Authentication
The public API and MCP server do not require authentication today. Both SDKs expose base URL, timeout, retry, and transport configuration so API keys or authenticated hosts can be added later without changing method names.
Examples
JavaScript / TypeScript
await client.searchModels({ query: "gpt", provider: "openai" });Python
client.search_models(query="gpt", provider="openai")JavaScript / TypeScript
await client.findCheapest({ provider: "openai", limit: 5 });Python
client.find_cheapest(provider="openai", limit=5)JavaScript / TypeScript
await client.compareModels(["openai-gpt-5", "anthropic-claude-4-sonnet-20250514"]);Python
client.compare_models(["openai-gpt-5", "anthropic-claude-4-sonnet-20250514"])JavaScript / TypeScript
const model = await client.getModel("openai-gpt-5");
client.calculateCost(model, { inputTokens: 1000, outputTokens: 500, requests: 10000 });Python
model = client.get_model("openai-gpt-5")
client.calculate_cost(model, input_tokens=1000, output_tokens=500, requests=10000)JavaScript / TypeScript
await client.providerSummary("openai");Python
client.provider_summary("openai")JavaScript / TypeScript
await client.latestChanges({ provider: "openai", limit: 10 });Python
client.latest_changes(provider="openai", limit=10)JavaScript / TypeScript
await client.benchmarkLookup({ benchmarkId: "mmlu" });Python
client.benchmark_lookup(benchmark_id="mmlu")JavaScript / TypeScript
await client.callMcpTool("find_cheapest", { provider: "openai", limit: 5 });Python
client.call_mcp_tool("find_cheapest", {"provider": "openai", "limit": 5})Coverage
| Area | Methods |
|---|---|
| API endpoints | listProviders, getProvider, listModels, getModel, listRankings, getRanking, getHistory, getMarket, getChangelog |
| Helpers | searchModels, findCheapest, compareModels, calculateCost, providerSummary, latestChanges, benchmarkLookup, pagination helpers |
| MCP | mcpRequest, listMcpTools, callMcpTool, listMcpResources, readMcpResource, listMcpPrompts, getMcpPrompt |
Continue
Public API
Use static JSON endpoints for providers, models, rankings, history, market metrics, and changelog events.
Editorial information
2026-08-04
Methodology explains collection, validation, limitations, and update cadence.