Skip to content

Architecture and migrationGuide

Artificial intelligence APIs: a developer's map for 2026

Ten categories of AI API, the providers that serve each, the two wire formats most of them copy, which ones answer in a second and which hand you a job id, and the billing unit of each.

By INFRO Editorial

Published

8 min read

Dark ground with amber light spreading across a grid of glass tiles, each tile a different shape for text, image, sound and motion, joined by fine lines to one central node

In short

Artificial intelligence APIs fall into about ten categories: chat and reasoning models, embeddings, rerank, image, video, speech-to-text, text-to-speech, music, moderation and decision or classifier models. Most chat APIs follow one of two wire formats, OpenAI's Chat Completions or Responses and Anthropic's Messages; media APIs are often asynchronous jobs; and each category bills in its own unit, such as tokens, images, seconds of video, minutes of audio or characters.

Key takeaways

  • Group AI APIs by what they return, not by vendor: text, vectors, scores, images, video, audio or a decision. Each group has its own request lifecycle and billing unit.
  • Two wire formats dominate text: OpenAI's Chat Completions and Responses, and Anthropic's Messages. Compatibility layers exist, and they drop fields.
  • Long media work is asynchronous: submit, get an id, then poll or receive a webhook. Design for that from the first line of code.
  • Pricing units differ by modality: tokens, images, seconds, minutes, characters, songs or search units. Store the unit with every usage record.
  • Rate limits belong to the provider account and its tier, so every API you add brings its own ceilings.

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

CategoryWhat it returnsExamples of providers and modelsUsual lifecycleTypical billing unit
Chat and reasoning (LLM API)Text, tool calls, structured JSONOpenAI Responses and Chat Completions; Anthropic Messages; Google GeminiSynchronous or streamed; background mode for long runsInput and output tokens
EmbeddingsVectorsOpenAI text-embedding-3-*; Google Gemini Embedding 2; Cohere EmbedSynchronous, batchableTokens (Google also per image, second or frame)
RerankRelevance scores for documentsCohere RerankSynchronousSearch units
ImageGenerated or edited imagesOpenAI gpt-image-2; Google Gemini image modelsSynchronous, sometimes queuedImage and text tokens, or per image
VideoVideo filesGoogle Veo; models hosted on fal's queueAsynchronous jobSeconds of output
Speech-to-textTranscriptsOpenAI transcription models; ElevenLabs Scribe v2Synchronous for short files, realtime streamsMinutes of audio, or tokens
Text-to-speechAudioOpenAI TTS; ElevenLabs; Gemini TTSSynchronous or streamedCharacters, or tokens
Music and soundAudio tracksElevenLabs Music; Google LyriaSynchronous or jobPer song or clip
ModerationCategory flags and scoresOpenAI omni-moderation-latestSynchronousFree at OpenAI
Decision and classifierA label, score or action bandDecision models such as TypeSafe's Jev; any classifier behind an APISynchronous, often batchedVaries by provider
A map of AI API categories. Every name in it comes from the cited vendor documentation below; none is a ranking.

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 background option for long runs2. Anthropic's Claude API serves POST /v1/messages, a Message Batches API and a token-counting endpoint3.
  • Embeddings. OpenAI prices text-embedding-3-small and -large per million tokens4. Google's Gemini Embedding 2 bills text per token, images per image, audio per second and video per frame5. Cohere's POST /v2/embed takes a required input_type such as search_document or search_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-compatible images.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-1 per 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:

  1. Request and response. Embeddings, rerank, moderation, most images and short transcriptions. Set a timeout and retry idempotent failures.
  2. 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.
  3. Jobs. Video, long media and long reasoning runs. OpenAI's background mode returns a response you poll at GET /v1/responses/{id} while it is queued or in_progress. Background responses that are not stored are deleted after about ten minutes, so collect results promptly15. fal's queue reports IN_QUEUE, IN_PROGRESS and COMPLETED, can POST the result to your webhook, and may retry delivery, so it tells you to use request_id for 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.

one_client.py
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.

Questions readers ask

What are the main types of AI APIs?
Text generation (chat and reasoning models), embeddings, rerank, image generation and editing, video generation, speech-to-text, text-to-speech, music and sound, content moderation, and decision or classifier models. Most products use two or three of them together, for example embeddings and rerank to find context and a chat model to answer.
Which AI API should a developer start with?
Start with the category your feature needs and a provider whose documentation covers the parameters you depend on, such as streaming, tool calls or structured output. Build against an OpenAI-compatible client with a configurable base URL, so trying a second provider later is a configuration change.
Are all LLM APIs OpenAI-compatible?
No. Many providers offer an OpenAI-compatible endpoint, including Google's Gemini API and Anthropic's Claude API, but these layers can ignore fields. Anthropic, for example, documents that its compatibility layer ignores the strict flag on tools and does not support prompt caching, and recommends its native Messages API for the full feature set.
Why do some AI APIs return a job id instead of a result?
Because the work takes longer than an HTTP request should stay open. Video renders and long-running model responses are submitted, return an id at once, and finish later; you poll a status endpoint or receive a webhook. Treat delivery as at-least-once and deduplicate on the id.

From the team that builds it

Where this shows up in INFRO

INFRO is a control plane in front of the provider accounts you already hold. The capabilities below are the parts of it this article touches, each with the documentation that defines its behaviour.

  • Provider connections

    Available with a plan

    Connect provider accounts you already hold. Each credential is encrypted when saved, scoped to your organization and never shown again; applications use INFRO gateway keys instead.

    Read the documentation for Provider connections
  • Text — OpenAI-compatible

    Available with a plan

    POST /v1/chat/completions with the request shape the OpenAI SDKs already send, including streaming and tool calling.

    Read the documentation for Text — OpenAI-compatible
  • Image, video, and audio

    Available with a plan

    One request shape per modality across every model, with video and long audio running as async jobs.

    Read the documentation for Image, video, and audio
  • Async jobs and webhooks

    Available with a plan

    Submit long renders, get a job id immediately, receive a signed webhook on completion.

    Read the documentation for Async jobs and webhooks
  • Rerank

    Available with a plan

    POST /v1/rerank in Cohere's shape, served by Jev on your own TypeSafe connection or by any other decision model you connect: each passage judged against the query, ordered by the probability it is relevant.

    Read the documentation for Rerank
  • Decisions with Jev

    Available with a plan

    Saved questions your code calls as POST /v1/decisions/{slug}, answered by Jev on your own TypeSafe connection or by any other decision model you connect: an outcome, a confidence band from your thresholds, pins decided before any model call, a deadline with a fallback, and batches of up to 500 items. Tool-call gating, triage, evals, labeling and control loops are templates of it.

    Read the documentation for Decisions with Jev
  • Claude Code and Codex through INFRO

    Available with a plan

    Point Claude Code, the Claude Agent SDK, Codex or the OpenAI Agents SDK at INFRO by changing the base URL and the key. Anthropic's Messages API and OpenAI's Responses API, with routing, budgets refused before the call, guardrails and the request log applied as on every other request.

  • Health-aware routing

    Available with a plan

    Named routes use priority or weighted targets over your own connections, with health checks, retries and failover.

    Read the documentation for Health-aware routing
  • Automatic failover

    Available with a plan

    A route that times out or 5xxs before the response starts is retried elsewhere without your client seeing it.

    Read the documentation for Automatic failover
  • Usage and cost per request

    Available with a plan

    Every request records its model, latency, token or unit counts, and estimated provider cost, queryable by project and key.

    Read the documentation for Usage and cost per request

INFRO accounts are self-serve. Provider usage is billed to you by your providers; INFRO charges a software subscription and takes 0% of model spend. See plans.

Sources

Numbered in order of first citation. Each was opened and checked against the claim on the date shown.

  1. 1.Create chat completion — API reference (opens in a new tab) — OpenAI. Accessed Oct 19, 2026.
  2. 2.Create a model response — API reference (opens in a new tab) — OpenAI. Accessed Oct 19, 2026.
  3. 3.API overview (opens in a new tab) — Anthropic. Accessed Oct 19, 2026.
  4. 4.Pricing (opens in a new tab) — OpenAI. Accessed Oct 19, 2026.
  5. 5.Gemini Developer API pricing (opens in a new tab) — Google. Accessed Oct 19, 2026.
  6. 6.Embed API (v2) (opens in a new tab) — Cohere. Accessed Oct 19, 2026.
  7. 7.Rerank API (v2) (opens in a new tab) — Cohere. Accessed Oct 19, 2026.
  8. 8.OpenAI compatibility (opens in a new tab) — Google. Accessed Oct 19, 2026.
  9. 9.Queue (opens in a new tab) — fal. Accessed Oct 19, 2026.
  10. 10.Text to Speech (opens in a new tab) — ElevenLabs. Accessed Oct 19, 2026.
  11. 11.Speech to Text (opens in a new tab) — ElevenLabs. Accessed Oct 19, 2026.
  12. 12.Music (opens in a new tab) — ElevenLabs. Accessed Oct 19, 2026.
  13. 13.Moderation (opens in a new tab) — OpenAI. Accessed Oct 19, 2026.
  14. 14.OpenAI SDK compatibility (opens in a new tab) — Anthropic. Accessed Oct 19, 2026.
  15. 15.Background mode (opens in a new tab) — OpenAI. Accessed Oct 19, 2026.
  16. 16.Authentication (opens in a new tab) — ElevenLabs. Accessed Oct 19, 2026.
  17. 17.Rate limits (opens in a new tab) — OpenAI. Accessed Oct 19, 2026.
  18. 18.Rate limits (opens in a new tab) — Anthropic. Accessed Oct 19, 2026.

About this article

Every provider fact in this article comes from that provider's own documentation or pricing page, opened on 2026-10-19 and cited where it is used. Pricing appears only as units; the figures in the example block are illustrative and are not any provider's rates. INFRO's behaviour comes from its public docs and availability registry, read the same day.

Last checked against its sources on . The next review is due by . No separate named reviewer is recorded for this article.

How articles are written, sourced and corrected is set out in the editorial standards.

Revision history

  1. INFRO now serves POST /v1/embeddings; the sentence that said it did not is corrected.