Quickstart
Find a compatible deployment and calculate a deterministic quote in under five minutes with TypeScript, Python, or the REST API.
Prerequisites
- Node.js 20+ for the TypeScript SDK, or Python 3.11+ for the Python SDK.
- An ALLM API key stored in
ALLM_API_KEY. - A server-side environment. Never expose a secret key in browser code.
1. Install an SDK
Terminal · TypeScript
pnpm add @allm/sdkTerminal · Python
pip install allmYou can skip installation and use the REST examples throughout the reference with curl.
2. Configure the client
TypeScript
import { ALLM } from "@allm/sdk";
const allm = new ALLM({ apiKey: process.env.ALLM_API_KEY });Python
import os
from allm import ALLM
allm = ALLM(api_key=os.environ["ALLM_API_KEY"])3. Find a compatible deployment
TypeScript
const result = await allm.deployments.list({
model: "anthropic/claude-haiku-4.5",
capability: "tool_calling",
region: "global",
});
const deployment = result.data[0];
if (!deployment) throw new Error("No compatible deployment found");
console.log(deployment.id);
// dep_anthropic_claude_haiku_4_5_messages_globalFilter semantics
The
capability filter returns only deployments whose assertion is supported. It excludes conditional, unknown, and unsupported.4. Calculate a quote
TypeScript
const quote = await allm.pricing.calculate({
deployment: "dep_openai_gpt_5_1_responses_global",
inputTokens: 1_000_000,
outputTokens: 100_000,
});
console.log(quote.totalUsd); // "2.250000"
console.table(quote.lineItems);Console output
┌─────────────────────┬──────────┬────────────┐
│ dimension │ quantity │ amountUsd │
├─────────────────────┼──────────┼────────────┤
│ input_tokens │ 1000000 │ 1.250000 │
│ cached_input_tokens │ 0 │ 0.000000 │
│ output_tokens │ 100000 │ 1.000000 │
└─────────────────────┴──────────┴────────────┘Money values are exact decimal strings. Keep them as strings or parse them with a decimal library.
5. Production checklist
- Handle structured errors and retain
x-request-idfor diagnostics. - Use timeouts and retry only
429, transient5xx, and network failures. - Store the selected deployment with
x-allm-catalog-release. - Pin important decisions in a lockfile and review catalog drift.