POST /v1/messages takes the Anthropic Messages request shape and runs it on the Allternit model router. Scope inference. (Texting is at /v1/texts.)
Request
model, max_tokens, messages (role and content as a string or blocks of text, image, tool_use, tool_result), system, tools (name, description, input_schema), tool_choice, stream, metadata, and thread.
thread keeps history on Allternit: { "type": "create" } starts one, { "type": "continue", "previous_message_id": "mdl_…" } continues it. There is no expiry. system and tools are set on create only; changing them on continue gives 400 thread_fingerprint_mismatch.
Response
stop_reason is end_turn, tool_use or max_tokens. A tool_use block has id, name and input; answer with a tool_result block. Model message ids start with mdl_, so they never clash with text ids (msg_).
Streaming events: message_start, content_block_start, content_block_delta (text_delta, input_json_delta), content_block_stop, message_delta, message_stop.
Not supported: thinking blocks, server tools and files.
Billing
The project pays. The project needs a card on file first, sandbox included; without one the request answers402 payment_method_required (see Billing). Model tokens are recorded as tokens_in and tokens_out usage rows and billed to the project at the model’s list price plus 15%, as in Pricing. They count toward the project’s monthly spend cap: at the cap a new message answers 402 spend_cap_reached. No member’s personal credits are used, whichever key or console session made the call. A streamed message is billed once, when it ends. A message that fails at the model is not billed.