08.03

The Anthropic Messages API

skillmaxingPython with AIThe Anthropic Messages API
Visual lesson

The Anthropic Messages API

Included with Pro · 4:29
Lessons · 895 words

The Messages API is Anthropic's endpoint for Claude. You send a list of messages that alternate between user and assistant, plus a system prompt and a token cap, and you receive a message whose content is a list of blocks. The shape is deliberately explicit: nothing is a convenience string, and the response tells you why it stopped. Once you have seen it beside the Responses API, the two look like dialects of the same idea, and Relay can treat the provider as a setting.

Messages in, blocks out
Figure 1Messages in, blocks outThe reply carries typed blocks, a stop reason, and usage counts.
uv add anthropic
export ANTHROPIC_API_KEY=sk-ant-...
Pro

Continue reading

Pro unlocks every video lesson, the full notes and runnable code across the Python with AI course, from the language itself to agents, MCP, Langfuse and deployment.

Unlock full access to
Python with AIAI researchComplete system design
30% off with LAUNCH30ends in 7h 40m
Buy now
View all plans ·Already Pro? Sign in
124 online