Messages
Anthropic-compatible Messages API.
POST https://api.solcardinference.ai/v1/messagesRequest and response follow the Anthropic Messages format. Authenticate with x-api-key or Authorization: Bearer; the anthropic-version header is accepted and not required.
| Field | Type | Notes |
|---|---|---|
model |
string |
Required. A model ID. |
messages |
array |
Required. user and assistant messages with text, tool_use and tool_result blocks. |
max_tokens |
integer |
Up to 32,768. |
system |
string | array |
|
stream |
boolean |
|
temperature |
number |
|
top_p |
number |
|
top_k |
integer |
|
stop_sequences |
array |
|
tools |
array |
Custom tools with input_schema. Server tools (web search and others) are left out. |
tool_choice |
object |
|
thinking |
object |
type enabled, adaptive or disabled, optional budget_tokens and display. Earlier turns’ thinking blocks can be sent back as they came. |
output_config |
object |
effort (low to max) and a json_schema format. |
Not supported: image and document blocks.
Count tokens
Section titled “Count tokens”POST https://api.solcardinference.ai/v1/messages/count_tokensTakes the same body (without max_tokens) and returns { "input_tokens": 1234 }. It costs nothing.
Example request
Section titled “Example request”curl https://api.solcardinference.ai/v1/messages \ -H "x-api-key: $SOLCARD_INFERENCE_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "solcard-inference-fast", "max_tokens": 512, "messages": [{ "role": "user", "content": "Hi" }] }'