Create a message
Anthropic’s Messages API. model is ambral/auto with an x-workload header (or ambral/auto:<workload>), which serves the workload’s primary model and records the call to its traces. The answer is in the Messages API’s own response schema, with id the call’s own id, model the model that served it, and usage.cost what the call costs, in USD; any other key the provider adds to the message, its usage, a block or an event is removed (a block or delta of a type the schema doesn’t name is kept whole). With stream: true the answer is named server-sent events, as the Messages API streams them: message_start with the id and model, each block’s start, deltas and stop, message_delta with the stop reason and the whole call’s usage and cost, then message_stop, which ends the stream; ping keeps it open, and an error event is a failure after the 200, or Ambral couldn’t read the provider’s event. Otherwise it is one JSON message, or the error envelope when Ambral couldn’t read it. Every error is Anthropic’s envelope, with Ambral’s code beside its type, and an error the provider answers reaches the client with the provider’s status. The request’s content blocks, the top-level keys the Messages API names, and the provider’s own extension keys are passed through as they were sent; any other key is left out. A request Ambral must price and can’t is a 400: one that would let the provider choose another model, or run a tool or add-on Ambral doesn’t price, or that asks for a premium setting Ambral doesn’t price yet (fast speed, a regional inference_geo). A client tool, which has no type, custom, or one of Anthropic’s versioned client tools (bash_20250124, text_editor_*, computer_*, memory_*), is priced; any other tool is run by the provider.
Headers
<run>; workload=<workload>; model=<model>: the request is a call of an eval run, which Ambral's SDKs set. A request that names no workload (no x-workload, no model suffix) is for the run's. A request for the run's workload is served the run's model, one of the workload's pool, and a request for another workload that workload's primary. Either way it is recorded as an eval trace of the run, never as production. It needs a session, and a value that doesn't parse is a 400.
Labels on the request's session, key=value or a bare tag, comma-separated: up to 16. A key is lowercase letters, digits, ., _ and -, starting with a letter or digit, at most 63 characters. A value is letters, digits, spaces and . _ : / @ + -, at most 128 characters; spaces around it are dropped. A session's labels gather every request's, a later value replacing an earlier one's; once a session holds 16, a later request's new keys are dropped. Invalid labels are ignored, all of them, and the response says why in its own x-ambral-labels header.
Body
Response
The provider's answer: one message, or a stream of events.
- Option 1
- Option 2
The message, or the error envelope when Ambral couldn't read the provider's answer.