POST https://www.myai168.com/en/api/anthropic/v1/messagesClaude Messages API (Claude Opus / Sonnet / Haiku), supports streaming, prompt caching and thinking. The only supported server-side tool is web search (Code Execution and the Files API are not supported — see the support matrix below).
curl https://www.myai168.com/en/api/anthropic/v1/messages \
-H "x-api-key: YOUR_DEV_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"claude-opus-4-8","max_tokens":1024,"messages":[{"role":"user","content":"Hello"}]}'
import requests
r = requests.post(
"https://www.myai168.com/en/api/anthropic/v1/messages",
headers={
"x-api-key": "YOUR_DEV_KEY",
"anthropic-version": "2023-06-01",
},
json={"model": "claude-opus-4-8", "max_tokens": 1024, "messages": [{"role": "user", "content": "Hello"}]},
)
print(r.json())
Some Anthropic SDK features behave differently through this relay. Check this matrix before integrating to avoid surprises.
GET /v1/models and GET /v1/models/{model} —
supported (compatible with SDK models.list /
models.retrieve). Returns exactly the models
this relay accepts; models not in the list are rejected with
"No pricing info! Please use other models!".POST /v1/messages — supported, including streaming,
prompt caching (billed at official cache rates) and thinking.POST /v1/messages/count_tokens — supported, free.web_search_* types) —
supported and billed per search.mcp_servers) and the Files API — not supported, HTTP 400.
Use client-side tool use instead. Reason: all relay users share one
upstream workspace, so exposing the Files API / code-execution
containers would create a cross-user file-access risk; they are
disabled for security.X-Cost-Points (points
charged) and X-Credits-Remaining (balance after the call)
headers. Streaming responses append the same information after the event
stream ends as SSE comment lines : cost=N /
: credits-remaining=M. You can also query your balance any
time with GET https://www.myai168.com/en/api/user/get_credits.The request body is JSON, identical to the official Anthropic Messages API spec. Authenticate with an x-api-key: YOUR_API_KEY or Authorization: Bearer YOUR_API_KEY header (never place keys in URL query strings).
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | required | Model id (e.g. claude-opus-4-8). Must be in the GET /v1/models list, otherwise 400 with "No pricing info! Please use other models!". |
max_tokens | integer | required | Maximum reply tokens (required by the official spec). |
messages | array | required | Conversation messages, each {"role": "user" | "assistant", "content": "..."}; content may also be a list of content blocks (including base64 images). |
system | string or array | optional | System prompt — the official API accepts a string, or an array of text content blocks (TextBlockParam); the array form lets you attach cache_control to individual blocks for prompt caching. |
stream | boolean | optional | true streams the response as SSE. |
thinking | object | optional | Extended thinking settings (forwarded per official spec). |
tools | array | optional | Client-side tool definitions are forwarded as-is; the only accepted server-side tool is web search (web_search_*), others return 400. |
temperature / top_p / stop_sequences etc. | — | optional | Other official parameters are forwarded as-is. |
Non-streaming: the official message object — take the text from the blocks in the content array whose type is text (with thinking enabled the first block is a thinking block, and tool calls add tool_use blocks, so never assume content[0] is text); usage is in usage.input_tokens / usage.output_tokens; response headers include X-Cost-Points (points charged) and X-Credits-Remaining (balance after the call).
Streaming: SSE event stream (message_start / content_block_delta / message_delta / message_stop) with text deltas in content_block_delta's delta.text; after the event stream ends, SSE comment lines : cost=N / : credits-remaining=M carry the points charged and remaining balance.
curl -N https://www.myai168.com/en/api/anthropic/v1/messages \
-H "x-api-key: YOUR_API_KEY" \
-H "anthropic-version: 2023-06-01" \
-H "Content-Type: application/json" \
-d '{"model":"claude-sonnet-5","max_tokens":1024,"stream":true,"messages":[{"role":"user","content":"Hello"}]}'
| HTTP status | Meaning |
|---|---|
401 | Missing or invalid API key (repeated failures from the same IP are temporarily blocked). |
402 | Insufficient credits (please top up). |
400 | Invalid request body, model not in the supported list ("No pricing info! Please use other models!"), or an unsupported server-side tool was requested. |
502 | Upstream vendor error — never charged. |
No points are ever charged on errors (including when the vendor returns no usage info).