LearnThatStack Ace your next interview
AI Engineering
LLM APIs & Integration.
Change topic Change
Practice · Questions

All questions

Showing of 55
Beginner 12
01

What is an LLM API, and which major provider APIs should an engineer know in 2026?

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

02

Walk me through the anatomy of a basic chat request: messages, roles, and the system prompt.

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

03

What does the max_tokens parameter control, and what happens when a response hits that limit?

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

04

How do you authenticate requests to the Anthropic, OpenAI, and Gemini APIs?

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

05

How is LLM API usage billed, and what exactly is a token?

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

06

What is streaming, and why do production chat apps almost always enable it?

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

07

What is a context window, and what happens if you exceed it?

Beginner ·

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:

Keep going - a few more words and AI can grade it.

Last attempt -

Your answer

Re-explain

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.

Rewriting in plainer words…

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 ↓

Related concept

Tailored explanation · switch back to · ·
What should the new diagram focus on?
How well did you know this?
AI:

08

Your frontend needs LLM features. Where does the API key live, and why?

Part of Pro
09

A request returns HTTP 429. What does it mean, and what should your client do?

Part of Pro
10

What is JSON mode, and how is it different from just asking the model for JSON in the prompt?

Part of Pro
11

When would you use an official SDK versus calling the REST endpoints directly?

Part of Pro
12

What do sampling parameters like temperature and top_p do, and what is their status across current models?

Part of Pro
Intermediate 22
13

Compare the request and response shapes of Anthropic, OpenAI, and Gemini. What differs beyond field names?

Part of Pro
14

How does server-sent-event streaming work on the wire, and what event sequence does the Anthropic API emit?

Part of Pro
15

What does robust client-side handling of streamed chunks look like?

Part of Pro
16

Explain function calling (tool use) end to end. How does the model actually "call" your function?

Part of Pro
17

How do you structure the tool-use loop, and when does it terminate?

Part of Pro
18

What are parallel tool calls, and how do you return the results correctly on each provider?

Part of Pro
19

How do structured outputs guarantee schema conformance, and what are the limits?

Part of Pro
20

How do you send images to these APIs, and what practical constraints matter?

Part of Pro
21

How do the major providers handle PDFs and other documents?

Part of Pro
22

The product wants voice input. Compare audio support across providers and outline a portable pipeline.

Part of Pro
23

What dimensions do LLM rate limits come in, and how do you plan capacity against them?

Part of Pro
24

Design a retry policy for LLM API calls. Which errors do you retry, and how?

Part of Pro
25

What timeout behavior do the SDKs have by default, and what gotchas bite in production?

Part of Pro
26

How does Anthropic prompt caching work mechanically, and what does it cost?

Part of Pro
27

How do OpenAI and Gemini approach prompt caching, and how does that compare with Anthropic's explicit model?

Part of Pro
28

When and how do you use batch APIs, and what do they cost?

Part of Pro
29

How do you count tokens accurately before sending a request, and why does the tool choice matter?

Part of Pro
30

Which usage fields do you read to compute the true cost of a request?

Part of Pro
31

A chat session grows past the context window. How do you manage conversation history without breaking prompt caching?

Part of Pro
32

What is the OpenAI Responses API, and how does it differ from Chat Completions and the Assistants API it replaces?

Part of Pro
33

What is the Model Context Protocol (MCP), and how does it relate to a provider's function-calling API?

Part of Pro
34

How do you call reasoning models through an API, and what changes about parameters, tokens, and cost?

Part of Pro
Expert 21
35

How do you design prompts so caches actually hit? Walk me through cache-friendly prompt architecture.

Part of Pro
36

Explain the economics of prompt caching: TTLs, write premiums, and break-even math.

Part of Pro
37

Walk me through a production error taxonomy for LLM APIs. Which failures are retryable, and which need different handling?

Part of Pro
38

LLM APIs have no idempotency keys. How do you make retries safe in a system with side effects?

Part of Pro
39

A streamed response fails halfway through. What can go wrong mid-stream, and how should clients recover?

Part of Pro
40

Beyond basic tool calling, how do you control when and how the model uses tools?

Part of Pro
41

How would you design model routing and fallbacks across multiple providers?

Part of Pro
42

What is LiteLLM, and how would you use it in production?

Part of Pro
43

What is OpenRouter, and when would you choose it over direct provider integrations?

Part of Pro
44

How do model versioning and deprecations work, and what is your migration playbook?

Part of Pro
45

What should you log, measure, and trace for LLM API calls in production?

Part of Pro
46

What changes about LLM integration when you deploy on serverless versus a long-running server?

Part of Pro
47

How do you architect for long-running LLM tasks like agent loops or deep research jobs?

Part of Pro
48

What goes wrong when teams build a "provider-agnostic" abstraction over LLM APIs?

Part of Pro
49

Design a production-grade resilience layer for LLM traffic: retries, circuit breakers, hedging, and fallbacks working together.

Part of Pro
50

How do you architect prompt caching at fleet scale, across tenants, deployments, and routing decisions?

Part of Pro
51

Define latency and cost SLOs for an LLM-backed product, and explain how you plan capacity against them.

Part of Pro
52

Design the API key and secrets architecture for a company running LLM workloads across several teams and environments.

Part of Pro
53

Structured outputs still fail in production. Where do failures come from at scale, and how do you engineer reliability around them?

Part of Pro
54

A model you depend on is being retired in 90 days. Walk me through a deprecation-resilient upgrade architecture.

Part of Pro
55

Tool results carry untrusted web and document text. How do you keep prompt injection from triggering real actions?

Part of Pro

No matches

Try a different filter or search term.

Know someone prepping for LLM APIs & Integration? Send them this set.
Pro · $10/mo

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.

Technologies
No technologies match “”.
Cross-cutting topics
No topics match “”.
By role
Stacks & frameworks

MEAN

MongoDB, Express, Angular, Node.js

MERN

MongoDB, Express, React, Node.js

LAMP

Linux, Apache, MySQL, PHP

Django

Python Full-Stack Development

Ruby on Rails

Convention over Configuration

Serverless on AWS

Serverless Architecture on AWS

Flutter Mobile

Flutter Cross-Platform Mobile Development

Spring Boot

Enterprise Java Development

.NET

Microsoft Ecosystem

Vue

Vue.js, Vite, TypeScript, Tailwind, Node.js

Go Backend

Golang, gRPC, PostgreSQL, Redis, RabbitMQ

FastAPI

Python, FastAPI, SQLAlchemy, PostgreSQL

React Native

React, TypeScript, Redux, Firebase

iOS Native

Swift, SwiftUI, UIKit, Firebase

Android Native

Java, Jetpack Compose, Firebase

DevOps / Platform

Docker, Kubernetes, Terraform, CI/CD

AI Engineer

LLMs, RAG, Agents, Evals

AI-Powered Developer

Claude Code, Copilot, Agentic Workflows

Core SWE Interview Prep

Data structures, algorithms, OS, concurrency, networking, git