Skip to main content
Use this endpoint for clients that expect the Anthropic Messages format. The examples below cover text requests. Compatibility does not imply every upstream feature is available.

1. Set your API key

Create an API key and add balance in the AsterWise app. In your terminal, replace the placeholder:

2. Send a request

POST https://api.asterwise.dev/v1/messages
--include displays response headers as well as the body. Omit it if you want only JSON. Keep your API key private.

Request fields

The example cap of 1,024 tokens limits this response’s length. It is not the model’s maximum context window or a rate limit.

Generation controls

thinking configures thinking behavior; output_config.effort selects effort. Code supports low / high; Work also supports minimal, medium, and xhigh. The example selects effort without prescribing a separate thinking budget. Top-level reasoning and reasoning_effort are not Messages fields. For defaults, unavailable controls, tool-choice restrictions, and the DeepSeek sampling no-op exception, see parameters and model compatibility.

Reasoning and tool example

Use this JSON body with the endpoint and authentication headers above. It illustrates the supported request shape; it is not a new live-provider acceptance result. Automatic tool selection allows the model to answer without calling the tool.
Your application executes get_build_status when requested. Append the assistant content containing tool_use, then a user message containing tool_result with the matching tool_use_id. Preserve the rest of the supplied conversation and supported thinking blocks.

3. Read the response

Illustrative text-only response, checked against AsterWise’s response handling. IDs, answer text, and token counts below are examples, not a captured production request. Additional fields may be present.
Read text blocks in content: each block with type: "text" has a text field. Other blocks, such as tool requests, can also appear. stop_reason: "end_turn" indicates a normal completed turn. max_tokens indicates that the response reached its output cap. usage reports token counts, not a dollar charge.

Streaming

Change "stream": false to "stream": true in the request above and add --no-buffer to curl. Read the response as server-sent events (SSE), not as one JSON document. The following is an abbreviated example:
Append delta.text for text_delta content events. Track input usage from message_start and final output usage from message_delta. This excerpt omits the opening message and content-block events; handle the full lifecycle in your client.

Errors

Gateway authentication and request-validation errors before streaming starts use an HTTP error status and the JSON format below. Malformed JSON, oversized bodies, or proxy errors can have a different response format; check the status and content type before parsing. For example, an invalid key returns 401:
This is AsterWise’s shared gateway error format, including on the OpenAI-compatible endpoints. Handle error.type rather than assuming an upstream error schema. AsterWise currently has no per-minute request or token rate limits. A 429 can still indicate a spending or simultaneous-request control. Once an SSE stream has started, an error may arrive as an error event rather than a new HTTP status. Do not treat HTTP 200 alone as a completed response. Save the x-request-id response header when present, and check Usage if the connection ends unexpectedly. See troubleshooting and usage and billing.