Create Anthropic message
Chat
Anthropic Messages
Call the full Claude model family through the native Anthropic protocol.
POST
Create Anthropic message
If you already use the official Anthropic SDK, or want native Claude capabilities such as system prompts, Tool Use, and Prompt Caching, call
We recommend including the
Response (abridged):
Node.js:
If the model response contains
/v1/messages directly. It follows the official Anthropic protocol.
The native Anthropic protocol uses the dedicated
api-direct.dimilinks.com domain, which is different from the OpenAI-compatible dimilinks.com/v1 base URL. Both use the same key.Request URL
anthropic-version header explicitly to match Anthropic’s official documentation. Requests without it are also supported and use the server’s default version.
Basic example
Streaming
Add"stream": true. The server then returns native Anthropic events in this order: message_start / content_block_start / content_block_delta / content_block_stop / message_delta / message_stop.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Claude model ID, such as claude-opus-4-8, claude-sonnet-5, or claude-haiku-4-5. |
max_tokens | integer | Yes | Maximum output tokens for one response. |
messages | array | Yes | Message array. role supports user / assistant; content supports a string or [{type:"text",...}] content blocks. |
system | string | array | No | System prompt, either a string or an array such as [{type:"text",...}]. |
temperature | number | No | Sampling temperature from 0 to 1. |
top_p | number | No | Nucleus sampling probability from 0 to 1. |
top_k | integer | No | Top-k sampling. |
stop_sequences | string[] | No | Stop generation when one of these sequences is matched. |
stream | boolean | No | When true, returns SSE streaming events. |
tools | array | No | Native Anthropic Tool Use definitions. |
tool_choice | object | No | Controls whether a specific tool must be used. |
metadata | object | No | Metadata such as an end-user identifier. |
Call with the Anthropic SDK
Python:Set the Anthropic SDK
base_url to https://api-direct.dimilinks.com/. The SDK appends /v1/messages automatically.Tool Use
content[].type === "tool_use", execute the tool, then continue the conversation with a tool_result content block in a role=user message.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Anthropic API version, e.g. 2023-06-01.
Example:
"2023-06-01"
Body
application/json
Response
Anthropic message response. When stream is true the response is text/event-stream with Anthropic native events.