Docs pages

Messages

POSThttps://api.steerwise.s3techpulse.com/v1/messages

Anthropic’s Messages API, for the Anthropic SDKs and Claude Code. It serves Claude models only, and "model": "auto" picks only among them. Needs a key with the inference scope.

Example

Code samples in
bashpythonjavascript
curl https://api.steerwise.s3techpulse.com/v1/messages \
  -H "x-api-key: $STEERWISE_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "auto",
    "max_tokens": 1024,
    "messages": [
      { "role": "user", "content": "Say hello in one short sentence." }
    ]
  }' 
import os
import anthropic

client = anthropic.Anthropic(
    base_url="https://api.steerwise.s3techpulse.com",
    api_key=os.environ["STEERWISE_API_KEY"],
)

msg = client.messages.create(
    model="auto",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Say hello in one short sentence."}],
)
print(msg.model, msg.content[0].text)
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  baseURL: "https://api.steerwise.s3techpulse.com",
  apiKey: process.env.STEERWISE_API_KEY,
});

const msg = await client.messages.create({
  model: "auto",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Say hello in one short sentence." }],
});
console.log(msg.model, msg.content);

The Python and Node samples use Anthropic’s SDKs, with the host as the base URL (no /v1).

Example response (json, 200)
{
  "id": "msg_<id>",
  "type": "message",
  "role": "assistant",
  "model": "<the Claude model that served the call>",
  "content": [ { "type": "text", "text": "<the reply>" } ],
  "stop_reason": "end_turn",
  "usage": { "input_tokens": <n>, "output_tokens": <n> }
}

Request headers

  • anthropic-version: 2023-06-01 (the default when absent) or 2026-10-21. Any other version is refused.
  • anthropic-beta: forwarded, except the refused values below.
  • The key goes in x-api-key or Authorization: Bearer.

Request body

  • modelstringRequired

    auto, or a Claude model id from GET /v1/models.

  • max_tokensintegerRequired

    The output limit. It is reserved in full against your limits and wallet until the call ends, then what was not used is returned.

  • messagesarrayRequired

    Anthropic’s messages, forwarded as sent.

  • systemstring or array

    The system prompt. Steerwise adds a short per-organisation block to it, so prompt caches are never shared across organisations.

  • toolsarray

    Anthropic tools. Server tools with per-use fees are refused (see below).

  • streamboolean

    Anthropic’s event stream, frame for frame.

  • metadataobject

    user_id is replaced by an opaque hash of your organisation and the value sent.

  • speedstring

    Only standard.

  • inference_geostring

    Only global.

  • service_tierstring

    Only auto or standard_only.

Every field not listed here is forwarded as sent, unknown fields and block types included. Steerwise changes only this:

  • model becomes the model that serves the call.
  • A short per-organisation block is added to system; a cache_control on a tool moves to that block.
  • A cache_control.ttl other than 5m is removed: caching lasts 5 minutes. Cache reads and writes are billed at the model’s cache prices.
  • Thinking blocks are returned and accepted back as they are.

Refused

Refused with 400 invalid_request_error, worded as Anthropic words the same refusal, so Claude Code carries on without the feature:

  • thread, diagnostics, container, mcp_servers and file sources (source.type: file).
  • Server tools with per-use fees: web_search_*, code_execution_*, advisor_*.
  • anthropic-beta values files-api-*, skills-*, code-execution-*, mcp-client-* and fast-mode-*. oauth-* values are dropped silently.

Routing

There is no fallback to another model on this endpoint. With auto the model is picked as on the other endpoints, but the call stays on its pick: it does not move up a tier on a refusal.

Response

Anthropic’s Message, as the model produced it, with model set to the model that served the call. Response headers: x-request-id (also as request-id), x-steerwise-routed-from, x-steerwise-run and the rate limit headers.

With "stream": true only : ping comment lines are sent while the model starts; message_start then names the served model. An error after the stream opened arrives as event: error and the stream ends.

Count tokens

POSThttps://api.steerwise.s3techpulse.com/v1/messages/count_tokens

Anthropic’s token count for a Messages body (without max_tokens), with the same changes and refusals as POST /v1/messages. The count includes the per-organisation system block, because those tokens are sent and billed.

  • Counting is not billed and does not use your rate limits. It has its own allowance of 120 calls per minute per key (429 rate_limit_exceeded with retry-after).
  • The response is {"input_tokens": <n>}.

Errors

Errors use Anthropic’s shape, so the Anthropic SDKs and Claude Code handle them as usual. The Steerwise code is in error.details.error_code. A rejection of the request by the model itself (400, 413, 422) is forwarded with its own status and body. retry-after is in whole seconds, and 5xx answers carry x-should-retry: true.

Example error (json, 402)
{
  "type": "error",
  "error": {
    "type": "billing_error",
    "message": "<what happened>",
    "details": { "error_code": "spend_cap_reached" }
  },
  "request_id": "<x-request-id>"
}
Messages errors
Statuserror.typeerror_codeWhen
400invalid_request_errorinvalid_requestThe body is malformed, a field is missing or invalid, a feature is refused (above), or the model is not available here. When the model itself rejects the request, its own status (400, 413 or 422) and body are forwarded, with no error_code.
400invalid_request_errorcontext_length_exceededThe prompt is over your plan’s or key’s context limit.
401authentication_errormissing_api_keyNo key was sent.
401authentication_errorinvalid_api_keyThe key is malformed, unknown, revoked or expired.
402billing_errorinsufficient_balanceThe wallet balance is too low for this request.
402billing_errorspend_cap_reachedSpend has reached a daily or monthly cap of the key or the organisation, or the agent run’s cap.
402billing_errorrequest_cost_cap_exceededThis request’s worst case (the model, the prompt and the full output limit) is over the per-request cap.
403permission_erroraccount_suspendedThe organisation or user is suspended.
403permission_errorwallet_frozenStaff have put the organisation’s wallet on hold.
403permission_errorkey_pausedThe key is paused, usually by the runaway-spend detector after its spend jumped far past its usual rate.
403permission_errormissing_scopeThe key lacks the scope this endpoint needs.
403permission_errormodel_not_allowedYour plan does not include the model.
403permission_errormodel_not_allowed_for_keyThe key’s allowed models exclude this model.
404not_found_errormodel_not_foundNo active model has that id.
413request_too_largerequest_too_largeThe body is over 32 MiB, or the model rejected the request as too large.
429rate_limit_errorrate_limit_exceededA per-minute request or token limit, or the limit on calls at once, of the organisation, user, key or model.
429rate_limit_errorinsufficient_quotaThe monthly token quota cannot cover this call’s reservation.
429rate_limit_errorspend_cap_pendingCalls still in flight could reach a spend cap.
429rate_limit_errorupstream_overloadedThe model is rate limited after retries.
500api_errorinternal_errorSomething failed on our side. Details are logged under the request id, never returned.
502api_errorupstream_errorThe model failed after retries, or a non-streaming call failed after the model had started its answer.
503api_errorupstream_overloadedSteerwise is holding back calls to the model for a short while.
503api_errorwallet_unavailableThe balance check could not run, so the request was not started.
503api_errorlimits_unavailableThe rate-limit check could not run, so the request was not started.
503api_errorserver_overloadedThe server is at its limit of requests at once.
503api_errorservice_unavailableThe key could not be checked in time. With x-should-retry: false and no Retry-After: no model that could serve the call is available right now.
503api_errorservice_restartingThe server is restarting and cancelled the request.
504timeout_errorupstream_timeoutThe model did not respond in time.
529overloaded_errorupstream_overloadedThe model is overloaded or unavailable after retries.

What to do about each one: Errors and limits.