Messages
Anthropic's Messages API, served so that Anthropic's clients and Claude Code run on HIPS's catalog models (decided 2026-10-29). A claude-* id is unknown on HIPS and answered so, never mapped to another model. The request is served by the chat completions route's own path, so the key, the requirement headers, the limits, the quote, placement and the response headers are those of chat completions; a field the route does not take is a 400 in Anthropic's wording.
/v1/messagesservedAnthropic's Messages API, with x-api-key and anthropic-version: 2023-06-01, in Anthropic's error shape.
curl https://ai.hips.com/v1/messages \ -H "x-api-key: $HIPS_API_KEY" \ -H "anthropic-version: 2023-06-01" \ -H "Content-Type: application/json" \ -d "{\"model\":\"$HIPS_MODEL\",\"max_tokens\":256,\"messages\":[{\"role\":\"user\",\"content\":\"Explain GPU inference in two sentences.\"}]}"Parts list: Request headers
x-api-keyAcceptedA workspace API key or a person's access token, as Anthropic's clients send it, on this route alone.
Authorization: Bearerworks too; both sent with different values is a 401invalid_api_key, and neither is a 401missing_api_key. Aninference_onlykey and a token with theinferencescope reach the route.anthropic-versionRequired2023-06-01. Absent is a 400missing_required_parameterwith Anthropic's wording,anthropic-version: header is required; another value is a 400invalid_valuenaming the one served.anthropic-betaRead, never refusedThe body's fields decide what is asked for: each field a beta adds is accepted or refused by the rules below.
x-hips-pool, x-hips-pricing-mode, x-hips-region, x-hips-fallbackAcceptedThe requirements, as on chat completions. A person's token takes the workspace's tool defaults.
A query string on the path (Claude Code sends ?beta=true) is ignored. The answer carries the response headers of chat completions, and on a whole answer x-hips-cost-micros and x-hips-latency-ms.
Parts list: Fields
modelRequiredA catalog id, an alias, a pinned id or a router name; unknown is a 404
not_found_errornaming the model.max_tokensRequiredA positive integer, the output cap. Over the model's
max_output_tokensit is a 400 in Anthropic's wording:max_tokens: <asked> > <maximum>, which is the maximum allowed number of output tokens for <model>.messagesRequired, non-emptyRoles
user,assistantandsystem, in the content blocks below; the lastuserorassistantmessage is ausermessage. Asystemmessage is your instruction from its place in the conversation on, as Anthropic's mid-conversation system messages are: a string ortextblocks, right after ausermessage (one oftool_resultblocks counts) and followed by anassistantmessage or ending the list, several in a row judged as one. It reaches the model at its place as the last text of the user message before it, inside<system-reminder>tags (after a turn oftool_resultblocks alone, a user message of its own), whether more of the conversation follows it or it ends the list: many models' chat templates take a system message at the start alone, and a model answers the conversation and calls its tools instead of continuing the instruction. A message's text blocks reach the model as one text, a blank line between each. Anywhere else it is a 400invalid_valuenaming the message,messages.<n>; it cannot be the first message, where the top-levelsystemfield holds what applies from the start. Any other role is a 400unsupported_value.systemAcceptedA string, or an array of
textblocks.streamAcceptedtruestreams the events below; absent orfalseanswers whole.temperature, top_pAcceptedNumbers from 0 to 1, Anthropic's range.
stop_sequencesAcceptedAt most 16 strings (decided 2026-11-01); more is a 400
invalid_value,stop_sequences: List should have at most 16 items.toolsAcceptedClient tools (
name,description,input_schema,cache_control,type: "custom",defer_loading), on a model that advertisestoolsin the pool the request resolves to. Anamematches^[a-zA-Z0-9_-]{1,128}$.defer_loading: truekeeps a tool from the model until a search finds it (Tool search, below). A server tool, Anthropic's own search tools among them, and any other field a beta adds to a tool (strict,input_examples,allowed_callers,eager_input_streaming), is a 400tools.<n>.<field>: Extra inputs are not permitted.tool_choiceAcceptedauto,any,toolwith itsname, ornone;disable_parallel_tool_use: trueasks for at most one call.context_managementAccepted when it clears thinkingEdits that are all
clear_thinking_20251015(itskeep"all"or{"type": "thinking_turns", "value": N}) are accepted and change nothing: no thinking block is returned, so there is none to clear. Any other edit or member is a 400unsupported_parameter,context_management: Extra inputs are not permitted.thinkingAcceptedadaptive,enabled(withbudget_tokens) anddisabledare accepted (decided 2026-11-01), and no thinking block is returned. Each sets the thinking level:disabledisnone, which turns the model's thinking off where the model can turn it off;enabledislowfor a budget under 4,096 tokens,mediumunder 16,384 andhighabove;adaptive, orenabledwith no budget, ismedium, the usual default.output_configAccepted for efforteffort(low,medium,highormax) is the thinking level, used over a thinking budget; a disabled thinking is used over it. Any other member, such asformat, is a 400unsupported_parameterin Anthropic's wording,output_config.<name>: Extra inputs are not permitted.metadatauser_id accepted, discardedNever stored, logged or sent to a worker. Any other member is a 400.
cache_controlAccepted where Anthropic places it{"type": "ephemeral"}onsystemblocks, content blocks and tools is accepted and changes nothing: HIPS caches a prompt's beginning by itself (Prompt caching). Attlof"5m"or"1h", as Claude Code sends it, is accepted as a hint and changes nothing either: HIPS's prompt cache keeps its own lifetime and promises none. Any otherttlis a 400invalid_value,<path>.cache_control.ttl: Input should be '5m' or '1h', and any other member a 400unknown_parameter.top_k, output_format, safeguards, service_tier, container, mcp_servers, speed, inference_geoRejected, 400 unsupported_parameterIn Anthropic's wording,
<name>: Extra inputs are not permitted, a nested field named by its path.Any other nameRejected, 400 unknown_parameterIn the same wording.
| Content block | In | Rule |
|---|---|---|
A string content, text | user, assistant, system | Text. A text block's citations, null or a list, is accepted wherever the block stands and changes nothing: none of it is sent to the model. Any other value is a 400 invalid_type |
image | user | A base64 source of image/jpeg, image/png, image/gif or image/webp, on a model that advertises vision. A url source is a 400 invalid_value: HIPS never fetches an image address |
tool_use | assistant | A call the model made earlier, replayed |
tool_result | user | The result of a call, a string or text, image and tool_reference blocks; is_error is accepted |
tool_reference | A tool_result | tool_name names a tool of tools, which the model is sent from then on (Tool search, below) |
thinking, redacted_thinking, document, search_result, server_tool_use, tool_addition, tool_removal and any other type | A 400 naming the block's type |
- Content block
- A string
content,text - In
user,assistant,system- Rule
- Text. A
textblock'scitations,nullor a list, is accepted wherever the block stands and changes nothing: none of it is sent to the model. Any other value is a 400invalid_type
- Content block
image- In
user- Rule
- A
base64source ofimage/jpeg,image/png,image/giforimage/webp, on a model that advertisesvision. Aurlsource is a 400invalid_value: HIPS never fetches an image address
- Content block
tool_use- In
assistant- Rule
- A call the model made earlier, replayed
- Content block
tool_result- In
user- Rule
- The result of a call, a string or
text,imageandtool_referenceblocks;is_erroris accepted
- Content block
tool_reference- In
- A
tool_result - Rule
tool_namenames a tool oftools, which the model is sent from then on (Tool search, below)
- Content block
thinking,redacted_thinking,document,search_result,server_tool_use,tool_addition,tool_removaland any othertype- In
- Rule
- A 400 naming the block's
type
A tool with defer_loading: true is part of the request and is not sent to the model, so its definition costs no input tokens. Your client's own search tool finds the tools a task needs and returns them as tool_reference blocks in its tool_result, as Anthropic's API takes them. From that request on, the model is sent every tool that is not deferred and each deferred tool a reference in the conversation names, in the order of tools, and reads Tool definitions loaded: <names>. where the references stood. A tool_choice that names a deferred tool sends it too. Claude Code's tool search for MCP tools works this way. HIPS runs no search itself: each request is one pass of the model, billed by its own usage, and the input tokens are those of the tools the model was sent.
- Every tool deferred: a 400
invalid_value,At least one tool must have defer_loading=false. All tools cannot be deferred. - More than 10,000 deferred tools in a request: a 400
invalid_value,tools: at most 10000 tools can have defer_loading=true. - A reference that names no tool of
tools: a 400invalid_value,Tool reference '<name>' not found in available tools. - Anthropic's server-side search tools (
tool_search_tool_regex_20251119,tool_search_tool_bm25_20251119) are server tools: a 400 as thetoolsfield says. The search runs in your client.
Parts list: The message object
idThe request id,
req_..., asx-hips-request-id.modelThe pinned id served, as
x-hips-model; under a router, the model it chose.contentA
textblock with the model's text, when it wrote any, then onetool_useblock per call (id,name,input). Arguments that are not JSON are given as a JSON string, never repaired.stop_reason, stop_sequencetool_use,max_tokens,stop_sequencewith the sequence where the engine names it, elseend_turn.pause_turnandrefusalare never sent.usageinput_tokens(the input not read from a cache),cache_read_input_tokens(the input tokens counted as cached),cache_creation_input_tokens(always0),output_tokens(every token the model wrote, its reasoning included, though this route returns none of it).
stream: true answers 200 with text/event-stream, each event as event: <type> and one data: line, relayed as the engine writes it. Nothing is sent before a worker answers, so a refusal before the first byte is an ordinary status and body. A ping event goes out while nothing else has been sent for the keep-alive interval. message_delta carries the cumulative usage and the hips object (cost_micros, latency_ms, quote), which Anthropic's clients ignore. A failure after the stream started is one event: error with the error object below, attempt_failed when the worker stopped, and the stream closes without message_stop; nothing is billed for it.
Streamed events
event: message_startdata: {"type":"message_start","message":{"id":"req_...","type":"message","role":"assistant","model":"<pinned id>","content":[],"stop_reason":null,"stop_sequence":null,"usage":{"input_tokens":0,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":0}}} event: content_block_startdata: {"type":"content_block_start","index":0,"content_block":{"type":"text","text":""}} event: content_block_deltadata: {"type":"content_block_delta","index":0,"delta":{"type":"text_delta","text":"..."}} event: content_block_stopdata: {"type":"content_block_stop","index":0} event: message_deltadata: {"type":"message_delta","delta":{"stop_reason":"end_turn","stop_sequence":null},"usage":{"input_tokens":0,"cache_creation_input_tokens":0,"cache_read_input_tokens":0,"output_tokens":0},"hips":{"cost_micros":0,"latency_ms":0,"quote":"quote_..."}} event: message_stopdata: {"type":"message_stop"}Every refusal on this route and the paths under it, the gateway's own included, is in Anthropic's shape, with the statuses and codes of the Errors page; code is an extension Anthropic's clients ignore, and request_id is x-hips-request-id.
Error
{ "type": "error", "error": { "type": "invalid_request_error", "message": "anthropic-version: header is required", "code": "missing_required_parameter" }, "request_id": "req_..."}| Status | `type` on this route |
|---|---|
| 400 | invalid_request_error |
| 401 | authentication_error |
| 402 | billing_error |
| 403 | permission_error |
| 404 | not_found_error |
| 429 | rate_limit_error, with retry-after in whole seconds and retry-after-ms in milliseconds |
| 503 | overloaded_error, with status 503: Anthropic's 529 is not used |
| 500 | api_error |
- Status
- 400
- `type` on this route
invalid_request_error
- Status
- 401
- `type` on this route
authentication_error
- Status
- 402
- `type` on this route
billing_error
- Status
- 403
- `type` on this route
permission_error
- Status
- 404
- `type` on this route
not_found_error
- Status
- 429
- `type` on this route
rate_limit_error, withretry-afterin whole seconds andretry-after-msin milliseconds
- Status
- 503
- `type` on this route
overloaded_error, with status 503: Anthropic's 529 is not used
- Status
- 500
- `type` on this route
api_error
A prompt longer than the model's context is worded as Anthropic words it, so a client compacts the conversation or lowers max_tokens: prompt is too long: <prompt> tokens > <context> maximum, or input length and max_tokens exceed context limit: <prompt> + <max_tokens> > <context>, decrease input length or max_tokens and try again. The prompt is never truncated.
Routes HIPS answers with a 404
| Route | Answer |
|---|---|
POST /v1/messages/count_tokens | 404 route_not_available (Count tokens) |
POST /v1/messages/batches and its routes, Anthropic's Files and Models APIs | 404 route_not_found; models are listed by `GET /v1/models` in OpenAI's shape |
- Route
POST /v1/messages/count_tokens- Answer
- 404
route_not_available(Count tokens)
- Route
POST /v1/messages/batchesand its routes, Anthropic's Files and Models APIs- Answer
- 404
route_not_found; models are listed by `GET /v1/models` in OpenAI's shape
| Status | Type | Code | Situation | Retry |
|---|---|---|---|---|
| 400 | invalid_request_error | missing_required_parameter | A required field or header is absent; param names it. On POST /v1/tasks, a classification model that answers in words and reads a response alone asked without options.prompt, at options.prompt (Safety classifiers) | No |
| 400 | invalid_request_error | invalid_value | A value is out of range or malformed: stop with more than 16 entries, a prompt_cache_key over 512 characters, a string holding a lone surrogate escape, a router name with an empty or unknown suffix, both max_tokens names with different values, an x-client-request-id header that is not printable ASCII or is over 512 characters (param x-client-request-id) | No |
| 400 | invalid_request_error | unknown_parameter | A field the gateway does not know, at any depth; param names it | No |
| 400 | invalid_request_error | unsupported_parameter | A known field HIPS does not accept, or a feature the named model does not advertise in the pool the request resolves to; param names it, and message names the model and what to send instead (an image to a model that takes no images says so, and that GET /v1/models lists each model's features) | No |
| 400 | invalid_request_error | context_length_exceeded | The prompt is over the model's context_length, or over the largest window any GPU serves it at now, or held only in a size that the GPUs able to hold it keep failing to read within the time limit; that limit and the prompt's count in the message, the limit the largest size that works now for this request, never more than the pool's context_window on Models; the prompt is never truncated. On embeddings and rerank, an input longer than the model reads at once, never cut | No |
| 400 | invalid_request_error | max_tokens_exceeded | max_tokens (on Responses max_output_tokens) over the model's max_output_tokens | No |
| 400 | invalid_request_error | guardrail_blocked | A content moderation guardrail with block found prompt injection or a sensitive pattern; param names the message and the error's guardrail member names the guardrail, the check and the pattern's type, never the matched text. Before any model ran; the request is not charged, only what its check read | No |
| 401 | authentication_error | missing_api_key | No Authorization header, or not a bearer (on Messages, no x-api-key either) | No |
| 401 | authentication_error | invalid_api_key | Unknown, malformed or revoked key or person's token; on Messages, x-api-key and Authorization carrying different values. The message never says which | No |
| 402 | billing_error | insufficient_credit | The balance does not cover the request's maximum cost at the bound quote | After a top-up |
| 402 | billing_error | budget_exceeded | A budget guardrail of the workspace, the key or the person is at its limit with block; the error carries guardrail and resets_at (null for a budget that never resets). Never a payment challenge | After resets_at, or once the limit is raised |
| 403 | permission_error | model_not_allowed, region_not_allowed | A model, or a region requirement, that an access guardrail keeps out, the guardrail named in the error's guardrail member | No |
| 404 | not_found_error | model_not_found | Unknown catalog id, alias, pinned id or dep_; another workspace's dep_; a name starting with hips-router that is not one of the four routers | No |
| 429 | rate_limit_error | rate_limit_exceeded | A rate limit; param is the counter that is full: requests, input_tokens (the prompt does not fit what is left of the input tokens a minute), output_tokens (the output tokens a minute are spent), uploads, batches (batches created per hour) or knowledge_search; Retry-After and retry-after-ms | Yes, after Retry-After |
| 429 | rate_limit_error | no_capacity, overloaded, pool_unavailable, model_loading | A key HIPS has set to answer at once when busy (HIPS sets it on the key a marketplace partner calls with; no workspace can set it): where no GPU is free for the request, it gets the answer the 503 of the same code gives, with its message and Retry-After, as a 429 at once, and never waits in the queue for a busy GPU; where another key would wait for a GPU that holds the model, it gets overloaded with the expected wait as Retry-After. Every other key gets the 503. A gateway over its own limits, and every other 503, stay 503 on every key | Yes, after Retry-After |
| 503 | overloaded_error | no_capacity | No eligible worker under the request's requirements, in any pool the requirements allow; Retry-After. The message says what those pools can do now: a GPU that fits the model takes it when free or loads it when asked, which can take minutes or longer; or nothing can serve it, and a retry sooner than the given delay gets the same answer; or the GPUs offering it have no speed figures yet for the setting they run it at, which a later retry may find measured. Where no price is in force for the model in any pool the request may use, the message says so, whatever supply there is, and the model's hips.availability reads unpriced | Yes, after the given delay |
| 503 | overloaded_error | overloaded | Eligible workers exist and every one is saturated, the queue is full, or the model is at its capacity right now. A request whose GPUs are all busy, or unavailable for a moment, waits for one up to 30 seconds first, and nothing is sent to a GPU while it is unavailable; a chat completions, Responses or Messages request whose GPU becomes unavailable before its answer begins waits the same way; Retry-After, from 1 to 30 seconds | Yes |
| 500 | api_error | attempt_failed | Every attempt failed for a reason that is not the client's and retries are exhausted: each GPU or server the request was placed on ended in an error before a complete answer, and no other can take it now. Nothing billed. The message says to retry once and, if it fails again, to send the request id (x-hips-request-id) to support | Once |
- Status
- 400
- Type
invalid_request_error- Code
missing_required_parameter- Situation
- A required field or header is absent;
paramnames it. OnPOST /v1/tasks, a classification model that answers in words and reads a response alone asked withoutoptions.prompt, atoptions.prompt(Safety classifiers) - Retry
- No
- Status
- 400
- Type
invalid_request_error- Code
invalid_value- Situation
- A value is out of range or malformed:
stopwith more than 16 entries, aprompt_cache_keyover 512 characters, a string holding a lone surrogate escape, a router name with an empty or unknown suffix, bothmax_tokensnames with different values, anx-client-request-idheader that is not printable ASCII or is over 512 characters (paramx-client-request-id) - Retry
- No
- Status
- 400
- Type
invalid_request_error- Code
unknown_parameter- Situation
- A field the gateway does not know, at any depth;
paramnames it - Retry
- No
- Status
- 400
- Type
invalid_request_error- Code
unsupported_parameter- Situation
- A known field HIPS does not accept, or a feature the named model does not advertise in the pool the request resolves to;
paramnames it, andmessagenames the model and what to send instead (an image to a model that takes no images says so, and thatGET /v1/modelslists each model's features) - Retry
- No
- Status
- 400
- Type
invalid_request_error- Code
context_length_exceeded- Situation
- The prompt is over the model's
context_length, or over the largest window any GPU serves it at now, or held only in a size that the GPUs able to hold it keep failing to read within the time limit; that limit and the prompt's count in the message, the limit the largest size that works now for this request, never more than the pool'scontext_windowon Models; the prompt is never truncated. On embeddings and rerank, an input longer than the model reads at once, never cut - Retry
- No
- Status
- 400
- Type
invalid_request_error- Code
max_tokens_exceeded- Situation
max_tokens(on Responsesmax_output_tokens) over the model'smax_output_tokens- Retry
- No
- Status
- 400
- Type
invalid_request_error- Code
guardrail_blocked- Situation
- A content moderation guardrail with
blockfound prompt injection or a sensitive pattern;paramnames the message and the error'sguardrailmember names the guardrail, the check and the pattern's type, never the matched text. Before any model ran; the request is not charged, only what its check read - Retry
- No
- Status
- 401
- Type
authentication_error- Code
missing_api_key- Situation
- No
Authorizationheader, or not a bearer (on Messages, nox-api-keyeither) - Retry
- No
- Status
- 401
- Type
authentication_error- Code
invalid_api_key- Situation
- Unknown, malformed or revoked key or person's token; on Messages,
x-api-keyandAuthorizationcarrying different values. The message never says which - Retry
- No
- Status
- 402
- Type
billing_error- Code
insufficient_credit- Situation
- The balance does not cover the request's maximum cost at the bound quote
- Retry
- After a top-up
- Status
- 402
- Type
billing_error- Code
budget_exceeded- Situation
- A budget guardrail of the workspace, the key or the person is at its limit with
block; the error carriesguardrailandresets_at(nullfor a budget that never resets). Never a payment challenge - Retry
- After
resets_at, or once the limit is raised
- Status
- 403
- Type
permission_error- Code
model_not_allowed,region_not_allowed- Situation
- A model, or a region requirement, that an access guardrail keeps out, the guardrail named in the error's
guardrailmember - Retry
- No
- Status
- 404
- Type
not_found_error- Code
model_not_found- Situation
- Unknown catalog id, alias, pinned id or
dep_; another workspace'sdep_; a name starting withhips-routerthat is not one of the four routers - Retry
- No
- Status
- 429
- Type
rate_limit_error- Code
rate_limit_exceeded- Situation
- A rate limit;
paramis the counter that is full:requests,input_tokens(the prompt does not fit what is left of the input tokens a minute),output_tokens(the output tokens a minute are spent),uploads,batches(batches created per hour) orknowledge_search;Retry-Afterandretry-after-ms - Retry
- Yes, after
Retry-After
- Status
- 429
- Type
rate_limit_error- Code
no_capacity,overloaded,pool_unavailable,model_loading- Situation
- A key HIPS has set to answer at once when busy (HIPS sets it on the key a marketplace partner calls with; no workspace can set it): where no GPU is free for the request, it gets the answer the 503 of the same code gives, with its message and
Retry-After, as a 429 at once, and never waits in the queue for a busy GPU; where another key would wait for a GPU that holds the model, it getsoverloadedwith the expected wait asRetry-After. Every other key gets the 503. A gateway over its own limits, and every other 503, stay 503 on every key - Retry
- Yes, after
Retry-After
- Status
- 503
- Type
overloaded_error- Code
no_capacity- Situation
- No eligible worker under the request's requirements, in any pool the requirements allow;
Retry-After. The message says what those pools can do now: a GPU that fits the model takes it when free or loads it when asked, which can take minutes or longer; or nothing can serve it, and a retry sooner than the given delay gets the same answer; or the GPUs offering it have no speed figures yet for the setting they run it at, which a later retry may find measured. Where no price is in force for the model in any pool the request may use, the message says so, whatever supply there is, and the model'ships.availabilityreadsunpriced - Retry
- Yes, after the given delay
- Status
- 503
- Type
overloaded_error- Code
overloaded- Situation
- Eligible workers exist and every one is saturated, the queue is full, or the model is at its capacity right now. A request whose GPUs are all busy, or unavailable for a moment, waits for one up to 30 seconds first, and nothing is sent to a GPU while it is unavailable; a chat completions, Responses or Messages request whose GPU becomes unavailable before its answer begins waits the same way;
Retry-After, from 1 to 30 seconds - Retry
- Yes
- Status
- 500
- Type
api_error- Code
attempt_failed- Situation
- Every attempt failed for a reason that is not the client's and retries are exhausted: each GPU or server the request was placed on ended in an error before a complete answer, and no other can take it now. Nothing billed. The message says to retry once and, if it fails again, to send the request id (
x-hips-request-id) to support - Retry
- Once
Related sheets
- Sheet
- 19 of 21
- Detail
- D
- Updated
- 2026-11-27