Claude chat

post/v1/messages

Anthropic Claude Messages API format. The anthropic-version request header is required.

Authentication

Send your OLETOKEN API key as a Bearer token. Keys are created on the API Keys page of the console.

Authorization: Bearer $OLETOKEN_API_KEY

Parameters

FieldTypeRequiredDescription
anthropic-versionheaderstringAnthropic API version
x-api-keyheaderstringAnthropic API key (optional; a Bearer token also works)

Request body

Content-Type:application/json

FieldTypeRequiredDescription
modelstring
messagesClaudeMessage[]
rolestringuserassistant
contentstring | object[]
typestringtextimagetool_usetool_result
textstring
sourceobject
typestringbase64url
media_typestring
datastring
urlstring
idstring
namestring
inputobject
tool_use_idstring
contentstring
systemstring | object[]
cache_controlobject
inference_geostring
max_tokensinteger≥ 1
temperaturenumber0–1
top_pnumber
top_kinteger
streamboolean
stop_sequencesstring[]
toolsobject[]
namestring
descriptionstring
input_schemaobject
tool_choiceobject
typestringautoanytoolnone
namestring
thinkingobject
typestringenableddisabled
budget_tokensinteger
context_managementobject
output_configobject
output_formatobject
containerstring | object
mcp_serversobject[]
metadataobject
user_idstring
speedstringstandardfast
service_tierstringautostandard_only

Responses

200Response created

FieldTypeRequiredDescription
idstring
typestring
rolestring
contentobject[]
typestring
textstring
modelstring
stop_reasonstringend_turnmax_tokensstop_sequencetool_use
usageobject
input_tokensinteger
output_tokensinteger
cache_creation_input_tokensinteger
cache_read_input_tokensinteger

Example request

curl -X POST 'https://api.oletoken.ai/v1/messages' \
  -H "Authorization: Bearer $OLETOKEN_API_KEY" \
  -H 'anthropic-version:' \
  -H 'x-api-key:' \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "claude-3-opus-20240229",
    "messages": [],
    "max_tokens": 0
  }'