API

Anthropic Messages API

POST /v1/messages accepts the Anthropic Messages format, so the Anthropic SDK and tools such as Claude Code work with your LLMHub key.

Request

curl https://api.llm-hub.dev/v1/messages \
  -H "x-api-key: $LLMHUB_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 256,
    "messages": [{"role": "user", "content": "Hello, Claude"}]
  }'
Python (anthropic)
import anthropic

client = anthropic.Anthropic(
    base_url="https://api.llm-hub.dev",
    api_key="YOUR_LLMHUB_API_KEY",
)

message = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=256,
    messages=[{"role": "user", "content": "Hello, Claude"}],
)
print(message.content[0].text)

The Anthropic SDK base URL is https://api.llm-hub.dev without /v1. The SDK adds /v1/messages itself.

Last updated