For the complete documentation index, see llms.txt. This page is also available as Markdown.

Messages

Anthropic-native Messages API for prompt-cache-preserving passthrough.

Create a message (Anthropic-native)

post

Anthropic-native Messages API. Accepts requests in Anthropic's wire format and forwards them to the upstream Anthropic provider byte-for-byte, preserving native features such as cache_control for prompt caching. Use this endpoint when the client already speaks Anthropic — it avoids the OpenAI translation layer that silently strips cache_control.

Authorizations
AuthorizationstringRequired
Bearer authentication header of the form Bearer <token>.
Body

Anthropic-native Messages API request body. Forwarded byte-for-byte to the upstream provider — cache_control markers are preserved exactly where the client placed them (system blocks, message content blocks, tool definitions, top-level).

modelstringRequired

Model identifier or alias resolved against the company's configured models. Must resolve to an Anthropic-provider model.

systemone ofOptional

System prompt as a single string or as an array of text blocks (each may carry cache_control).

stringOptional
or
max_tokensintegerRequired

Maximum output tokens. Set to 0 to warm the prompt cache without generating output.

temperaturenumber · max: 1 · nullableOptional

Sampling temperature. Note: the newest Claude models (Sonnet 4.6+/5) reject temperature, top_p, and top_k as deprecated.

top_pnumber · nullableOptional

Nucleus sampling. Rejected as deprecated by the newest Claude models.

top_kinteger · nullableOptional

Top-k sampling. Rejected as deprecated by the newest Claude models.

stop_sequencesstring[] · nullableOptional
streamboolean · nullableOptionalDefault: false
tool_choiceone of · nullableOptional

Controls how the model selects tools.

or
or
or
thinkingone of · nullableOptional

Extended thinking configuration.

or
or
service_tierstring · enum · nullableOptional

Anthropic API service tier. Note: models hosted on Vertex AI (currently all Claude models on the platform) reject this parameter.

Possible values:
containerstring · nullableOptional

Container reference for code-execution tools. Note: models hosted on Vertex AI (currently all Claude models on the platform) reject this parameter.

Responses
200

OK

Anthropic-native non-streaming Messages API response.

idstringRequired
typestring · enumRequiredPossible values:
rolestring · enumRequiredPossible values:
modelstringRequired
stop_reasonstring · enum · nullableOptionalPossible values:
stop_sequencestring · nullableOptional
stop_detailsobject · nullableOptional

Additional details about why the model stopped, when available.

post/v1/messages
POST /v1/messages HTTP/1.1
Host: api.nexos.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 137

{
  "model": "Claude Sonnet 5",
  "max_tokens": 1024,
  "messages": [
    {
      "role": "user",
      "content": "how many letters 'r' are in the word 'strawberry'?"
    }
  ]
}
200

OK

{
  "id": "text",
  "type": "message",
  "role": "assistant",
  "model": "text",
  "content": [
    {
      "type": "text",
      "text": "text",
      "cache_control": {
        "type": "ephemeral",
        "ttl": "5m"
      },
      "citations": [
        {
          "type": "text",
          "cited_text": "text",
          "document_index": 1,
          "document_title": "text",
          "start_char_index": 1,
          "end_char_index": 1,
          "start_page_number": 1,
          "end_page_number": 1,
          "start_block_index": 1,
          "end_block_index": 1
        }
      ]
    }
  ],
  "stop_reason": "end_turn",
  "stop_sequence": "text",
  "stop_details": {},
  "usage": {
    "input_tokens": 1,
    "output_tokens": 1,
    "cache_creation_input_tokens": 1,
    "cache_read_input_tokens": 1,
    "cache_creation": {
      "ephemeral_5m_input_tokens": 1,
      "ephemeral_1h_input_tokens": 1
    },
    "output_tokens_details": {
      "thinking_tokens": 1
    },
    "service_tier": "text",
    "server_tool_use": {
      "web_search_requests": 1
    },
    "nexos_credits_cost": 1
  },
  "container": {
    "id": "text",
    "expires_at": "2026-01-01T00:00:00.000Z"
  }
}

Last updated