All questions
Showing of 55What is an LLM API, and which major provider APIs should an engineer know in 2026?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
An LLM API lets an application send text or other inputs to a hosted model and receive generated content, tool calls, embeddings, or structured data. The provider manages model weights, accelerators, and serving infrastructure.
Engineers commonly encounter APIs from OpenAI, Anthropic, Google, cloud platforms, and services that host open-weight models. Exact model families change quickly, so learn the shared concepts: messages, context limits, streaming, tools, structured output, usage accounting, and rate limits.
Provider details still matter. Authentication, role names, event formats, safety responses, and model features are not identical. Use current official documentation and keep model IDs in configuration. Choose providers by measured quality, latency, cost, data policy, region, and operational support for the product's workload.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Walk me through the anatomy of a basic chat request: messages, roles, and the system prompt.
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
A chat request usually contains a model ID and an ordered list of messages. Each message has a role and content. Common roles represent application instructions, user requests, assistant replies, and tool results.
The system or developer instruction defines stable behavior such as scope, tone, and tool policy. User messages contain the current request and data. Previous assistant and user turns may be included when conversation history matters. Most APIs are stateless, so the application resends needed context on each call.
The request can also include output limits, tools, a response schema, and sampling settings. The response contains generated content plus metadata such as finish reason and token usage. Always inspect both, not just the text.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What does the max_tokens parameter control, and what happens when a response hits that limit?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
The maximum output token setting places a hard cap on how much the model can generate. Provider names differ, but the idea is the same: generation stops when the limit is reached.
If that happens, the finish reason normally indicates a length limit. The text may end mid-sentence, and JSON or tool arguments may be incomplete. A larger context window does not remove the need for a separate output cap.
Set the limit high enough for the expected response, then ask for a bounded structure or length in the prompt. Check the finish reason before parsing. Retrying with a larger limit may work for a read-only response, but continuing or repeating side-effectful agent work requires careful state handling.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
How do you authenticate requests to the Anthropic, OpenAI, and Gemini APIs?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
These APIs commonly use a secret API key sent in an HTTP header or handled by the official SDK. Cloud-hosted variants may use service accounts, identity tokens, roles, or workload identity instead.
Keep credentials on the server, never in browser code, mobile bundles, source control, logs, or prompts. Load them from a secret manager or protected environment at runtime. Use different credentials for development, staging, and production.
Apply least privilege where the platform supports it, rotate keys, and monitor usage by project or service. If a key is exposed, revoke it immediately and investigate its activity. Follow current provider documentation for exact header names and cloud authentication flows because they differ.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
How is LLM API usage billed, and what exactly is a token?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
A token is a small text unit processed by the model. It may be a word, part of a word, punctuation, or whitespace. Images, audio, cached input, and hidden reasoning may have separate token or unit accounting.
Providers usually bill input and output separately, and rates vary by model. Some also distinguish cache writes, cache reads, batch jobs, long contexts, or tool features. Prices change, so do not hard-code them into explanations or business logic.
Read the usage object returned by each request and calculate cost from a versioned price table. Track cost per successful product task, including retries and multi-step calls. Use the model's actual tokenizer or counting endpoint for preflight estimates.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is streaming, and why do production chat apps almost always enable it?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
Streaming sends parts of the response as the model generates them instead of waiting for the complete answer. HTTP APIs often deliver these updates through server-sent events.
Users see the first text sooner, which makes a slow generation feel responsive. The application can also display tool progress, usage updates, or status events when the provider exposes them. Total generation time may stay the same.
Streaming adds client work. Chunks may split words or JSON, event types must be assembled correctly, and errors can occur after partial output has been shown. Buffer structured data until it is complete, support cancellation, and mark an answer complete only after the final event and finish reason arrive.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
What is a context window, and what happens if you exceed it?
Answer it yourself first - out loud, or typed below.
How should your speech become text?
Listening… your words appear above as you speak - tap Stop when you're done.
Recording · cr - tap Stop & transcribe when you're done.
Transcribing with AI…
Voice:
Last attempt -
The context window is the maximum token budget for a request. It includes instructions, messages, tool definitions, documents, multimodal inputs, and usually the space needed for the response.
If a request is too large, the API may reject it or a client library may truncate content. Silent truncation is dangerous because it can remove system rules or important evidence. The exact behavior depends on the provider and endpoint.
Count tokens before large requests, reserve output space, and apply an explicit history policy. Common options are dropping irrelevant turns, summarizing old context, retrieving selected documents, and reducing tool descriptions. Log what was removed so a quality failure can be explained.
This answer doesn't lend itself to a diagram - it reads best . No credits were charged.
Why there's no diagram: “”
The interactive diagram is below the answer - jump to diagram ↓ · Below it, the related concept . Jump to it ↓
Your frontend needs LLM features. Where does the API key live, and why?
A request returns HTTP 429. What does it mean, and what should your client do?
What is JSON mode, and how is it different from just asking the model for JSON in the prompt?
When would you use an official SDK versus calling the REST endpoints directly?
What do sampling parameters like temperature and top_p do, and what is their status across current models?
Compare the request and response shapes of Anthropic, OpenAI, and Gemini. What differs beyond field names?
How does server-sent-event streaming work on the wire, and what event sequence does the Anthropic API emit?
What does robust client-side handling of streamed chunks look like?
Explain function calling (tool use) end to end. How does the model actually "call" your function?
How do you structure the tool-use loop, and when does it terminate?
What are parallel tool calls, and how do you return the results correctly on each provider?
How do structured outputs guarantee schema conformance, and what are the limits?
How do you send images to these APIs, and what practical constraints matter?
How do the major providers handle PDFs and other documents?
The product wants voice input. Compare audio support across providers and outline a portable pipeline.
What dimensions do LLM rate limits come in, and how do you plan capacity against them?
Design a retry policy for LLM API calls. Which errors do you retry, and how?
What timeout behavior do the SDKs have by default, and what gotchas bite in production?
How does Anthropic prompt caching work mechanically, and what does it cost?
How do OpenAI and Gemini approach prompt caching, and how does that compare with Anthropic's explicit model?
When and how do you use batch APIs, and what do they cost?
How do you count tokens accurately before sending a request, and why does the tool choice matter?
Which usage fields do you read to compute the true cost of a request?
A chat session grows past the context window. How do you manage conversation history without breaking prompt caching?
What is the OpenAI Responses API, and how does it differ from Chat Completions and the Assistants API it replaces?
What is the Model Context Protocol (MCP), and how does it relate to a provider's function-calling API?
How do you call reasoning models through an API, and what changes about parameters, tokens, and cost?
How do you design prompts so caches actually hit? Walk me through cache-friendly prompt architecture.
Explain the economics of prompt caching: TTLs, write premiums, and break-even math.
Walk me through a production error taxonomy for LLM APIs. Which failures are retryable, and which need different handling?
LLM APIs have no idempotency keys. How do you make retries safe in a system with side effects?
A streamed response fails halfway through. What can go wrong mid-stream, and how should clients recover?
Beyond basic tool calling, how do you control when and how the model uses tools?
How would you design model routing and fallbacks across multiple providers?
What is LiteLLM, and how would you use it in production?
What is OpenRouter, and when would you choose it over direct provider integrations?
How do model versioning and deprecations work, and what is your migration playbook?
What should you log, measure, and trace for LLM API calls in production?
What changes about LLM integration when you deploy on serverless versus a long-running server?
How do you architect for long-running LLM tasks like agent loops or deep research jobs?
What goes wrong when teams build a "provider-agnostic" abstraction over LLM APIs?
Design a production-grade resilience layer for LLM traffic: retries, circuit breakers, hedging, and fallbacks working together.
How do you architect prompt caching at fleet scale, across tenants, deployments, and routing decisions?
Define latency and cost SLOs for an LLM-backed product, and explain how you plan capacity against them.
Design the API key and secrets architecture for a company running LLM workloads across several teams and environments.
Structured outputs still fail in production. Where do failures come from at scale, and how do you engineer reliability around them?
A model you depend on is being retired in 90 days. Walk me through a deprecation-resilient upgrade architecture.
Tool results carry untrusted web and document text. How do you keep prompt injection from triggering real actions?
This answer is part of Pro.
The full written answer, with the trade-offs and follow-ups an interviewer will probe.
No matches
Try a different filter or search term.
LLM APIs & Integration cheatsheet
- Provider Comparison01
- Request Anatomy02
- Streaming (SSE) Patterns03
- Function / Tool Calling04
- Structured Outputs / JSON Mode05
- Multimodal Inputs06
- Prompt Caching07
- Batch APIs08
- Token Counting & Cost Estimation09
- Rate Limits, Retries, Backoff & Idempotency10
- Timeouts11
- Error Taxonomies12
- + 4 more inside
- + 10 more inside
48 of 55 LLM APIs & Integration answers are in Pro.
Full answers, code samples, and AI explanations that go simpler or deeper. Cancel anytime.
- Full answers + code
- AI explanations, simpler or deeper
- 1,000 AI credits / month
- Cancel anytime
Change topic
Pick a different technology or stack. Your current topic stays put until you choose a new one.
MEAN
MongoDB, Express, Angular, Node.jsMERN
MongoDB, Express, React, Node.jsDjango
Python Full-Stack DevelopmentRuby on Rails
Convention over ConfigurationServerless on AWS
Serverless Architecture on AWSInterviewers also test these - they're common to every stack, whichever one you picked above.
Flutter Mobile
Flutter Cross-Platform Mobile DevelopmentInterviewers also test these - they're common to every stack, whichever one you picked above.
Spring Boot
Enterprise Java Development.NET
Microsoft EcosystemVue
Vue.js, Vite, TypeScript, Tailwind, Node.jsGo Backend
Golang, gRPC, PostgreSQL, Redis, RabbitMQInterviewers also test these - they're common to every stack, whichever one you picked above.
FastAPI
Python, FastAPI, SQLAlchemy, PostgreSQLReact Native
React, TypeScript, Redux, FirebaseiOS Native
Swift, SwiftUI, UIKit, FirebaseAndroid Native
Java, Jetpack Compose, FirebaseDevOps / Platform
Docker, Kubernetes, Terraform, CI/CDInterviewers also test these - they're common to every stack, whichever one you picked above.
AI Engineer
LLMs, RAG, Agents, EvalsAI-Powered Developer
Claude Code, Copilot, Agentic WorkflowsCore SWE Interview Prep
Data structures, algorithms, OS, concurrency, networking, gitInterviewers also test these - they're common to every stack, whichever one you picked above.
Interviewers also test these - they're common to every stack, whichever one you picked above.