nexusflow
Online
Claude Messages API

Claude API Integration

NexusFlow's /v1/messages supports both Anthropic's native Claude models and compatibility-layer models. When model is claude-*, the request connects directly to the official Anthropic Messages API, preserving the native response and SSE event format.

✓ Protocol Coverage
/v1/messages supports all models available on NexusFlow — including the official Claude series as well as Qwen, GLM, DeepSeek, Kimi, MiniMax, and more.

Endpoint

POSThttps://nexusflow.hk/v1/messagesSync / Streaming

Request Parameters

ParameterRequiredDescription
modelYesClaude model ID, e.g. claude-sonnet-4-6, claude-opus-4-7
messagesYesArray of messages in Anthropic Messages format
max_tokensYesMaximum number of output tokens
streamNoWhen set to true, returns an Anthropic SSE event stream
systemNoSystem prompt, using Anthropic's top-level system field
toolsNoAnthropic tool definitions; for Claude models these are forwarded as-is to the official API

Supported Models & Official Pricing

ModelContextMax OutputUSD / MTok Input/Output
claude-opus-4-71M128K$5 / $25
claude-sonnet-4-61M64K$3 / $15
claude-haiku-4-5200K64K$1 / $5

Usage Examples

curl https://nexusflow.hk/v1/messages \
  -H "x-api-key: $API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-4-6",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Explain what a model gateway is in three sentences"}
    ]
  }'
curl https://nexusflow.hk/v1/messages \
  -H "x-api-key: $API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-haiku-4-5",
    "max_tokens": 1024,
    "stream": true,
    "messages": [
      {"role": "user", "content": "Write a product launch copy"}
    ]
  }'

Prompt Caching (Context Cache)

Prompt Caching is supported when calling via /v1/messages. Add a cache_control annotation to a content block in system or messages; repeated prefixes are cached, and subsequent requests get a 90% discount on the cached portion:

Token TypeBilling MultiplierDescription
cache_creation_input_tokens1.25xFirst write to cache
cache_read_input_tokens0.1xCache hit, 90% discount
input_tokens1xNon-cached portion, billed normally

Usage example: add "cache_control": {"type": "ephemeral"} to a system block. Ideal for repeated content like long system prompts and document context. Supported by all models under the /v1/messages protocol.

Related Docs