Skip to main content
POST
/
v1
/
messages
curl --request POST \
  --url https://api.octen.ai/v1/messages \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "model": "anthropic/claude-opus-4.8",
  "max_tokens": 2048,
  "messages": [
    {
      "role": "user",
      "content": "Explain attention in one sentence."
    }
  ]
}
'
{
  "id": "msg_01XFDUDYJgAACzvnptvVoYEL",
  "type": "message",
  "role": "assistant",
  "model": "anthropic/claude-opus-4.8",
  "content": [
    {
      "type": "text",
      "text": "Attention lets a model dynamically weight its inputs and focus on the most relevant information."
    }
  ],
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 18,
    "output_tokens": 32
  }
}

Authorizations

x-api-key
string
header
required

API key used for request authentication. Obtain an API key before using the API. Note: A payment method is required to use the API.

Headers

anthropic-version
string

Anthropic protocol version, e.g. 2023-06-01. Sent automatically by the Anthropic SDK. Defaults to 2023-06-01 if omitted.

Body

application/json

Request body for the Messages API. Some parameters apply only to certain models; unsupported parameters are ignored.

model
enum<string>
required

The model to use. Anthropic models also accept their native ids (e.g. claude-opus-4-8), which map to anthropic/claude-opus-4.8.

Available options:
anthropic/claude-opus-4.8,
anthropic/claude-opus-4.6,
anthropic/claude-sonnet-4.6,
anthropic/claude-haiku-4.5,
google/gemini-3.5-flash,
google/gemini-3.1-pro-preview,
google/gemini-3.1-flash-lite,
google/gemini-3-flash-preview,
openai/gpt-5.5-pro,
openai/gpt-5.5,
openai/gpt-5.4,
moonshotai/kimi-k2.6,
moonshotai/kimi-k2.5,
minimax/minimax-m2.5,
qwen/qwen3.6-plus
max_tokens
integer
required

Maximum number of tokens to generate.

Required range: x >= 1
messages
object[]
required

The conversation in chronological order.

system

System prompt.

tools
object[]

Tool definitions. Supports custom tools and the built-in octen_search server tool.

tool_choice
object

Controls whether and how the model calls tools.

stream
boolean
default:false

Whether to enable streaming output.

temperature
number
default:1

Controls randomness.

Required range: 0 <= x <= 1
top_p
number

Nucleus sampling. Set only one of temperature and top_p.

Required range: x <= 1
top_k
integer

Sample only from the top K tokens.

Required range: x >= 0
stop_sequences
string[]

Stop sequences.

thinking
object

Thinking options for reasoning models.

metadata
object

Request metadata.

Response

Successful message response. When stream=false, returns a single message object. When stream=true, returns an Anthropic SSE event stream.

A non-streaming response. Returned when stream=false.

id
string
required

The unique identifier for this request.

type
enum<string>
required

The response type. message on success.

Available options:
message,
error
role
enum<string>
required

Always assistant.

Available options:
assistant
model
string
required

The model used for this response.

content
object[]
required

The response content, as a list of content blocks.

stop_reason
enum<string>
required

Why the model stopped. end_turn is normal; tool_use means it awaits a custom tool result; pause_turn (Anthropic models only) means a long-running turn was paused, replay the returned content to continue.

Available options:
end_turn,
max_tokens,
stop_sequence,
tool_use,
pause_turn,
refusal
usage
object
required

Token usage information.

stop_sequence
string | null

The stop sequence that was hit, or null.