Artificial intelligence APIs are HTTP interfaces to models that generate or interpret text, images, video, audio and structured decisions. In practice they fall into about ten categories. Each category has its own request lifecycle, some answering in a second and some handing you a job id. Each also bills in its own unit, and most text APIs copy one of two wire formats. This map covers all three dimensions so you can choose, combine and budget for them without surprises.
It names providers only where their own documentation was checked on 2026-10-19. Model lineups change monthly, so treat the names as examples and the structure as the durable part.
The categories of AI APIs
| Category | What it returns | Examples of providers and models | Usual lifecycle | Typical billing unit |
|---|---|---|---|---|
| Chat and reasoning (LLM API) | Text, tool calls, structured JSON | OpenAI Responses and Chat Completions; Anthropic Messages; Google Gemini | Synchronous or streamed; background mode for long runs | Input and output tokens |
| Embeddings | Vectors | OpenAI text-embedding-3-*; Google Gemini Embedding 2; Cohere Embed | Synchronous, batchable | Tokens (Google also per image, second or frame) |
| Rerank | Relevance scores for documents | Cohere Rerank | Synchronous | Search units |
| Image | Generated or edited images | OpenAI gpt-image-2; Google Gemini image models | Synchronous, sometimes queued | Image and text tokens, or per image |
| Video | Video files | Google Veo; models hosted on fal's queue | Asynchronous job | Seconds of output |
| Speech-to-text | Transcripts | OpenAI transcription models; ElevenLabs Scribe v2 | Synchronous for short files, realtime streams | Minutes of audio, or tokens |
| Text-to-speech | Audio | OpenAI TTS; ElevenLabs; Gemini TTS | Synchronous or streamed | Characters, or tokens |
| Music and sound | Audio tracks | ElevenLabs Music; Google Lyria | Synchronous or job | Per song or clip |
| Moderation | Category flags and scores | OpenAI omni-moderation-latest | Synchronous | Free at OpenAI |
| Decision and classifier | A label, score or action band | Decision models such as TypeSafe's Jev; any classifier behind an API | Synchronous, often batched | Varies by provider |
The sources behind each row:
- Chat. OpenAI documents both Chat Completions1 and the Responses API, which accepts text, images and files, calls functions and built-in tools, and has a
backgroundoption for long runs2. Anthropic's Claude API servesPOST /v1/messages, a Message Batches API and a token-counting endpoint3. - Embeddings. OpenAI prices
text-embedding-3-smalland-largeper million tokens4. Google's Gemini Embedding 2 bills text per token, images per image, audio per second and video per frame5. Cohere'sPOST /v2/embedtakes a requiredinput_typesuch assearch_documentorsearch_query6. - Rerank. Cohere's Rerank takes a query and a list of documents, returns them ordered with a relevance score between 0 and 1, and reports usage as billed search units7.
- Image. OpenAI prices its image models, including
gpt-image-2, in image tokens and text tokens rather than per picture4. Google exposes Gemini image generation through its OpenAI-compatibleimages.generate8. - Video. Google bills Veo models per second of generated video5. fal serves hosted models, video among them, through a persistent queue: you submit, get a
request_id, then poll or take a webhook9. - Speech. OpenAI bills several transcription models per minute and others per token,
tts-1per million characters and newer speech models per token4. ElevenLabs documents a per-character price difference between its speech models10 and offers speech-to-text with Scribe v211. Gemini TTS models bill per token5. - Music. ElevenLabs' Music API is available to paid subscribers12. Google bills Lyria per song or per 30-second clip5.
- Moderation. OpenAI's moderation endpoint classifies text and images, does not classify audio, and is free to use13.
- Decisions. Decision models return a structured choice instead of prose; What is Jev and classifiers in the request path cover how they are used.
The two wire formats behind most LLM APIs
Most text APIs either are, or offer a copy of, one of two formats.
OpenAI's formats. Chat Completions takes a messages array with roles, including the system prompt as a message, and returns choices1. The newer Responses API takes input as a string or a list of items, and adds built-in tools and background execution2. Because so many SDKs, frameworks and agents speak Chat Completions, it is the format most third parties imitate. Google's Gemini API, for example, documents an OpenAI-compatible base URL for chat completions, embeddings and images, and labels that support beta8.
Anthropic's Messages. The system prompt is a top-level field, not a message. Content is a string or a list of typed blocks. Requests carry an anthropic-version header, with the key in Authorization: Bearer or the older x-api-key header3. Agent tools built on Claude speak this format natively.
Compatibility layers are useful for trying a model and risky to depend on blindly. Anthropic's own OpenAI SDK layer says it is primarily for testing and comparing models. It ignores strict on tools and response_format, does not support prompt caching or audio input, and concatenates every system message into one top-level system field. Anthropic recommends the native API for full features14. Before you migrate a workload, list the fields it depends on and check each against the layer's table. Migrating to an OpenAI-compatible API has the full checklist.
Synchronous calls, streams and asynchronous jobs
Three lifecycles cover almost every AI API:
- Request and response. Embeddings, rerank, moderation, most images and short transcriptions. Set a timeout and retry idempotent failures.
- Streaming. Chat and speech. The response arrives as server-sent events or audio chunks. Once the first chunk reaches your user, a retry on another provider would duplicate output, so a stream that fails midway should surface as an error.
- Jobs. Video, long media and long reasoning runs. OpenAI's background mode returns a response you poll at
GET /v1/responses/{id}while it isqueuedorin_progress. Background responses that are not stored are deleted after about ten minutes, so collect results promptly15. fal's queue reportsIN_QUEUE,IN_PROGRESSandCOMPLETED, can POST the result to your webhook, and may retry delivery, so it tells you to userequest_idfor idempotency9.
The job pattern is where most production bugs live: lost webhooks, duplicate deliveries, renders paid for twice. Async media jobs and webhooks covers idempotent submits, signature checks and the reconciler that catches events you never received.
Authentication, keys and rate limits
Each provider authenticates differently, even when the body looks the same. Anthropic takes Authorization: Bearer or x-api-key plus anthropic-version3. ElevenLabs uses an xi-api-key header16. fal expects Authorization: Key …9. Keep every provider key server-side, one per environment, and never ship one in a client app.
Rate limits are attached to the account, not to your code. OpenAI measures requests and tokens per minute and per day, images per minute and, for some audio models, audio minutes per minute. Limits apply per organization and project, and they rise as the organization moves through usage tiers17. Anthropic measures requests, input tokens and output tokens per minute per model class and tier. Its 429 responses may carry retry-after, and a monthly spend cap returns a 429 without one18. Every API you add brings its own ceilings, its own headers and its own way of saying "slow down".
How pricing units differ by modality
There is no common unit. Text bills input and output tokens, often with separate cached-input rates. Images bill per image or in image tokens. Video bills per second. Transcription bills per minute or per token, and speech per character or per token. Music bills per song or clip. Rerank bills search units. Some endpoints, such as OpenAI moderation, cost nothing4.
Two habits make this manageable. Record the unit and quantity with every usage row, never only a dollar figure. And mark a request you cannot price as unpriced, not as $0. AI API pricing explained goes deeper on each unit, and tokens are not the billing unit explains why even token costs rarely equal tokens times a rate.
Integrating many AI APIs behind one endpoint
Once a product uses three or four of these APIs, the code that talks to them starts to repeat: one client per provider, one retry loop per client, one spreadsheet per invoice. The common answer is to put one OpenAI-compatible endpoint in front of all of them. Applications keep a standard client; the endpoint translates to each provider's format, keeps media jobs asynchronous and records every call in one shape. One multimodal AI API describes the design.
The choice that matters is whose accounts sit behind that endpoint. An aggregator runs requests on its own provider accounts; a gateway over your own accounts leaves your contracts, negotiated rates and data agreements in place. AI aggregator platform vs AI gateway compares the shapes.
INFRO is that endpoint over your own accounts. You connect the providers you already use, and your applications call one base URL with an INFRO gateway key. That covers chat completions, responses and Anthropic's Messages format for agent tools, plus embeddings, images, speech, transcription, rerank, decisions and video. Video runs as an asynchronous job with webhooks or polling at /v1/jobs. Embeddings run on OpenAI, Azure OpenAI, Mistral or OpenAI-compatible connections, and fail over only to the same model, because vectors from different models are not comparable. Each request runs on one of your connections, and failover moves only between your own connections. Every record carries the provider, the unit and an estimate of what your provider will bill.
import os
from openai import OpenAI
client = OpenAI(base_url="https://api.infro.io/v1", api_key=os.environ["INFRO_API_KEY"])
answer = client.chat.completions.create(
model="anthropic/claude-sonnet-5",
messages=[{"role": "user", "content": "Summarize this transcript in three bullets."}],
)
image = client.images.generate(model="openai/gpt-image-2", prompt="A product diagram on a dark background")Your providers invoice you for the model usage; INFRO charges a subscription for the control plane. The quickstart connects a first provider and makes the first call, and the video docs cover the job lifecycle.
