Skip to main content
Model ID
Built with advanced reasoning and instruction-following capabilities, Claude Sonnet 4.5 excels at nuanced writing, multi-step problem solving, and tool use. It offers an optimal balance of intelligence and speed for demanding enterprise workloads.

API Usage

You can interact with the Anthropic Claude Sonnet 4.5 model through various programming languages and methods. Below are examples showing how to use the model’s API.

API Examples

Generate a model response using the chat endpoint of Anthropic Claude Sonnet 4.5.

Create chat completion

The Chat Completions API endpoint will generate a model response from a list of messages comprising a conversation.

Default

Streaming

Image Input

Functions

Python

Create a message

Anthropic’s native Messages API for generating model responses. Supports text and image inputs, and text outputs. Create stateful interactions with the model, using the output of previous responses as input. Extend the model’s capabilities with built-in tools for computer use, text editing, and more. Allow the model access to external systems and data using function calling. Enable extended thinking for complex reasoning tasks.

Default

Streaming

Extended Thinking

Functions

Image Input

PDF Input

Anthropic SDK (Python)

Install the official Anthropic SDK:
Basic Example
Streaming Example

Claude Code

Claude Code is Anthropic’s agentic coding tool that lives in your terminal. To use Claude Code with this API endpoint, set the following environment variables before starting Claude Code:
After setting these environment variables, you can launch Claude Code and it will automatically use the configured API endpoint.