Anthropic compatible
Messages
An Anthropic Messages compatible endpoint for Claude SDK, Claude Code, tools, and thinking. The body is validated strictly against the Anthropic schema, so OpenAI fields such as stop or response_format are rejected with 400. POST /v1/messages/count_tokens estimates input tokens.
POST
/v1/messagesKey request parameters
| Parameter | Type | Description |
|---|---|---|
model | string · Required | Model identifier |
messages | Message[] · Required | user / assistant messages; system messages are excluded |
max_tokens | integer · Required | Maximum number of generated tokens |
system | string | ContentBlock[] | System prompt |
stream | boolean | Whether to enable SSE; defaults to false |
tools | Tool[] | Function tool definitions |
Key response parameters
| Parameter | Type | Description |
|---|---|---|
id | string | Message ID |
content | ContentBlock[] | text, tool_use, or thinking content blocks |
stop_reason | string | end_turn, max_tokens, or tool_use |
usage | object | input_tokens and output_tokens |
X-HashBid-Cost | decimal string | Charge for this call (response header, non-streaming requests only); currency in X-HashBid-Cost-Currency |
Integration examples
Replace the API key and model ID in these examples with your values.
cURL
curl https://hashbidx.ai/v1/messages \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{"model":"<MODEL_ID>","max_tokens":1024,"messages":[{"role":"user","content":"Hello, HashBid"}]}'Python
import anthropic
client = anthropic.Anthropic(
api_key="<YOUR_API_KEY>", base_url="https://hashbidx.ai",
)
message = client.messages.create(
model="<MODEL_ID>", max_tokens=1024,
messages=[{"role": "user", "content": "Hello, HashBid"}],
)
print("".join(block.text for block in message.content if block.type == "text"))Node.js
import Anthropic from "@anthropic-ai/sdk";
const anthropic = new Anthropic({
apiKey: "<YOUR_API_KEY>",
baseURL: "https://hashbidx.ai",
});
const message = await anthropic.messages.create({
model: "<MODEL_ID>",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello, HashBid" }],
});
console.log(
message.content
.filter((block) => block.type === "text")
.map((block) => block.text)
.join(""),
);Go
body, _ := json.Marshal(map[string]any{
"model": "<MODEL_ID>",
"max_tokens": 1024,
"messages": []map[string]any{
{"role": "user", "content": "Hello, HashBid"},
},
})
req, _ := http.NewRequest("POST",
"https://hashbidx.ai/v1/messages", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer <YOUR_API_KEY>")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)Rust
let response = reqwest::Client::new()
.post("https://hashbidx.ai/v1/messages")
.bearer_auth("<YOUR_API_KEY>")
.json(&serde_json::json!({
"model": "<MODEL_ID>", "max_tokens": 1024,
"messages": [{"role":"user", "content":"Hello, HashBid"}]
})).send().await?;If the response includes X-Request-Id, include it when troubleshooting an issue.