Anthropic-compatible API
The Messages API is available with the same content blocks and streaming semantics. Authenticate with x-api-key and an anthropic-version header, or a Bearer token.
Endpoint
https://inferenceapi.wethinkdigital.solutions/v1/messagesCreate a model message. Supports streaming with server-sent events.
https://inferenceapi.wethinkdigital.solutions/v1/modelsList model IDs and capability metadata; shared with the OpenAI-compatible surface.
SDK base URL differs from the API path
/v1/messages itself. Configure the SDK with the API origin https://inferenceapi.wethinkdigital.solutions, not the full /v1 path.Authentication
Send your API token using x-api-key together with the required anthropic-version header. Alternatively, use the standard Bearer header. Never send both.
# Option A — Anthropic style
x-api-key: sk_live_xxxxxxxx
anthropic-version: 2023-06-01
# Option B — Bearer style
Authorization: Bearer sk_live_xxxxxxxx
anthropic-version: 2023-06-01Anthropic SDKs send the version header automatically. The platform accepts 2023-06-01 and ignores unknown versions rather than rejecting them, so existing clients keep working.
Create tokens from Dashboard → Tokens. The secret is displayed once. See Authentication for lifecycle controls.
Create a message
curl https://inferenceapi.wethinkdigital.solutions/v1/messages \
-H "x-api-key: sk_live_xxxxxxxx" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "model-pro",
"max_tokens": 512,
"messages": [
{
"role": "user",
"content": "Explain why idempotency matters for retried requests."
}
]
}'Core parameters
| Field | Type | Description |
|---|---|---|
| model | string | Required. A platform model ID from the active catalog. |
| max_tokens | integer | Required. Maximum generated output tokens. |
| messages | array | Required. Ordered user and assistant turns. Content can be a string or an array of content blocks. |
| system | string | Optional. System prompt for the conversation. |
| temperature | number | Optional. Sampling temperature. Supported range is model-dependent. |
| stream | boolean | Optional. Enables SSE streaming of message events. |
| tools | array | Optional. Tool definitions, when the model supports tools. |
Streaming
With stream: true, the API emits typed SSE events. Text arrives as incremental content_block_delta events; the message ends with message_stop.
curl -N https://inferenceapi.wethinkdigital.solutions/v1/messages \
-H "x-api-key: sk_live_xxxxxxxx" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{
"model": "model-pro",
"max_tokens": 512,
"stream": true,
"messages": [{ "role": "user", "content": "Write a short haiku." }]
}'event: message_start
data: {"type":"message_start","message":{"id":"msg_01J...","role":"assistant","usage":{"input_tokens":18,"output_tokens":0}}}
event: content_block_start
data: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}}
event: content_block_delta
data: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"Hello"}}
event: message_delta
data: {"type":"message_delta","delta":{"stop_reason":"end_turn"},"usage":{"output_tokens":24}}
event: message_stop
data: {"type":"message_stop"}Response fields
{
"id": "msg_01J...",
"type": "message",
"role": "assistant",
"model": "model-pro",
"content": [
{
"type": "text",
"text": "Idempotency ensures that retrying the same operation..."
}
],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 32,
"output_tokens": 96
}
}| Field | Type | Description |
|---|---|---|
| id | string | Unique message identifier. |
| content | array | Content blocks. Text blocks contain a text field; tool_use blocks contain tool inputs. |
| stop_reason | string | Why generation stopped: end_turn, max_tokens, stop_sequence, or tool_use. |
| usage | object | input_tokens and output_tokens used for billing. |
Token accounting
SDK setup
Install and initialize the SDK in your server application. Do not ship the token in a browser bundle.
import Anthropic from "@anthropic-ai/sdk";
export const client = new Anthropic({
// Server-side environment only.
apiKey: process.env.INFERENCE_API_KEY,
baseURL: "https://inferenceapi.wethinkdigital.solutions",
defaultHeaders: {
"anthropic-version": "2023-06-01",
},
});The SDK sends x-api-key by default. If your gateway requires Bearer auth, use authToken in the SDK configuration instead of apiKey.