Topic

APIs and pricing

The surface you actually code against. Price per million tokens, rate limits, structured outputs, tool calling, and the SDKs that wrap them.

Token pricing, structured outputs, SDKs03 articles07 glossary terms11 platforms
Articles

Read on this topic

Deep dives and guides filed under this topic, newest first.
All articles
Guide

Claude API pricing: caching, batch, and real bills

Claude API pricing for every current model as of November 8, 2026, with cache break-even math, batch stacking, tool fees, and a tested cost calculator.

14 min readAPIs and pricing

Guide

Gemini API pricing: free tier, caching, and real bills

Gemini API pricing for every current model as of November 8, 2026: free versus paid, cache storage math, batch, grounding, thinking, and a tested calculator.

16 min readAPIs and pricing

Deep dive

KV cache explained: what it stores and what it costs

A KV cache holds attention keys and values during LLM decode. Size one from config.json, see what concurrency costs, and how prompt caching reuses it.

11 min readInference and serving

Glossary

Terms you will meet

AI gateway
An AI gateway is a proxy between your application and one or more model providers that gives you one API for many models. It also adds routing, fallbacks, caching, rate limits, cost tracking, and logging in one place.
Batch API
A batch API is an asynchronous endpoint that takes many model requests at once, processes them within a time window, and bills them at a discount. You give up immediate responses in exchange for a lower price.
Constrained decoding
Constrained decoding is generation in which tokens that would break a grammar or schema are masked at each step before sampling. The output follows the grammar by construction, unless generation stops early.
Prompt caching
Prompt caching is a hosted API feature that reuses the processed state of a repeated prompt prefix, such as a long system prompt or a document, across calls. Providers that offer it bill cached input tokens at a discount and return the first token sooner.
Structured outputs
Structured outputs is an API feature that constrains a model's output to match a JSON Schema you supply, so successful responses parse against your schema. It is usually implemented with constrained decoding, which masks tokens that would break the schema.
Token
A token is the unit of text a model takes in and generates: a word, part of a word, a symbol, or a byte sequence, depending on the tokenizer. Context limits, speed, and API prices are all counted in tokens.
Tool callingFunction calling
Tool calling is a model returning a structured request to run a function you defined, with arguments, instead of plain text. Your code runs the function and sends the result back, which is how an agent loop reaches systems outside the model.