Messages
Anthropic-compatible messages endpoint. Content blocks, extended thinking, tool use, and streaming from a single surface.
The Messages API accepts requests in the Anthropic Messages format. Any
official Anthropic SDK works out of the box - just point its base URL at
https://api.aivene.com (the SDK adds /v1/messages itself).
POST /v1/messagesSend the conversation so far as a list of messages made of content blocks,
plus an optional system prompt, and the model replies with the next
assistant turn. Stream the response with stream: true to receive named
server-sent events, or get a single JSON payload otherwise.
What you can do
- Generate text - from one-shot answers to multi-turn agentic loops.
- Use tools - register tools with a JSON
input_schemaand let the model decide when to call them. See Tool use. - Think before answering - turn on extended thinking with
thinkingand control effort withoutput_config.effort. See Reasoning. - Read images and documents - attach
imageanddocumentblocks to ausermessage. See Multimodal. - Cache long prompts - mark stable prefixes with
cache_control. See Prompt caching.
Choosing a model
Every text model in the catalogue is available on this endpoint, not only
Claude models. The model id you send determines which model serves the
request, and the response echoes that same id. Some features depend on the
model, for example thinking, document blocks, or the Anthropic-defined client
tools. Browse available models at Models
or GET /v1/models.
Authentication
This endpoint accepts the API key in either header:
Authorization: Bearer <api_key>x-api-key: <api_key>- the header the Anthropic SDKs send.
When both are present, Authorization wins. Create keys at
Manage API Keys. See
Authentication.
Endpoints
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/messages | Create message |
Errors
Errors returned before the response starts share one shape:
{ "error": { "message": "...", "type": "invalid_request_error" } }| Status | error.type | Meaning |
|---|---|---|
400 | validation_error | The body failed schema validation. The message names the offending field. |
400 | invalid_request_error | Unknown model, content or a feature the model does not support (for example images, tools or output_config.format), or max_tokens above the model's limit. |
401 | authentication_error | Missing or invalid API key. |
402 | invalid_request_error | Not enough credit for the request, an unpaid balance, or a spend limit was reached. |
403 | permission_denied_error | The account is suspended, an Admin key was used, or the model isn't included in your organization's tier. |
404 | not_found_error | The model is deprecated. The message names its replacement. |
408 | timeout_error | The model did not finish before the request timed out (non-streaming requests). |
429 | rate_limit_error | Your organization hit its rate limit for this model. Back off and retry. |
500 | internal_server_error | Unexpected server error. |
502 / 503 | upstream_error | The model is temporarily unavailable. Safe to retry. |
Errors that happen after a stream has started arrive as an error event
instead. See Streaming events.