← All AI API providers

DEVELOPER FIELD NOTES / DOCS CHECKED 2026-09-23

Anthropic / Claude
API endpoint & setup.

Use the Anthropic SDK for Messages. Raw HTTP needs x-api-key, anthropic-version and max_tokens. The SDK adds /v1/messages.

SDK base URL

https://api.anthropic.com

Full request endpoint · POST

https://api.anthropic.com/v1/messages

Read the official Anthropic / Claude documentation ↗ · Checked 2026-09-23; no live API call made.

A small starting point.

Install the library shown below. Set AI_MODEL to a model available to your account and ANTHROPIC_API_KEY to your key. In cURL, replace YOUR_MODEL_ID. Replace any workspace placeholders before running.

Python

# pip install anthropic
import os
from anthropic import Anthropic

client = Anthropic(
    api_key=os.environ["ANTHROPIC_API_KEY"],
    base_url="https://api.anthropic.com",
)
response = client.messages.create(
    model=os.environ["AI_MODEL"], messages=[{"role": "user", "content": "Hello!"}], max_tokens=512
)
print(response)

Node.js

// npm install @anthropic-ai/sdk
// Server-side Node.js; never expose API keys in a browser.
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  apiKey: process.env.ANTHROPIC_API_KEY,
  baseURL: "https://api.anthropic.com",
});
const response = await client.messages.create({
  "model": process.env.AI_MODEL,
  "messages": [
    {
      "role": "user",
      "content": "Hello!"
    }
  ],
  "max_tokens": 512
});
console.log(response);

cURL

curl 'https://api.anthropic.com/v1/messages' \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  --data '{
  "model": "YOUR_MODEL_ID",
  "messages": [
    {
      "role": "user",
      "content": "Hello!"
    }
  ],
  "max_tokens": 512
}'

Before moving this into production.

Check model availability, billing, rate limits and supported parameters in the provider documentation. Start with a small request from your backend. Keep keys out of client-side JavaScript and source control.

These examples show the request shape and configuration. They do not test your credentials or guarantee access to a model.

Compare other AI API endpoints →