curl --request POST \
--url https://api.opper.ai/v3/compat/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"max_tokens": 123,
"messages": [
{
"content": "<unknown>",
"role": "<string>"
}
],
"model": "<string>"
}
'import requests
url = "https://api.opper.ai/v3/compat/v1/messages"
payload = {
"max_tokens": 123,
"messages": [
{
"content": "<unknown>",
"role": "<string>"
}
],
"model": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
max_tokens: 123,
messages: [{content: '<unknown>', role: '<string>'}],
model: '<string>'
})
};
fetch('https://api.opper.ai/v3/compat/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"content": [
"<unknown>"
],
"id": "<string>",
"model": "<string>",
"role": "<string>",
"stop_reason": "<string>",
"stop_sequence": "<string>",
"type": "<string>",
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"cache_creation_input_tokens": 123,
"cache_read_input_tokens": 123,
"server_tool_use": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}Messages
Anthropic Messages API compatible endpoint. Supports streaming via the stream parameter.
curl --request POST \
--url https://api.opper.ai/v3/compat/v1/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"max_tokens": 123,
"messages": [
{
"content": "<unknown>",
"role": "<string>"
}
],
"model": "<string>"
}
'import requests
url = "https://api.opper.ai/v3/compat/v1/messages"
payload = {
"max_tokens": 123,
"messages": [
{
"content": "<unknown>",
"role": "<string>"
}
],
"model": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
max_tokens: 123,
messages: [{content: '<unknown>', role: '<string>'}],
model: '<string>'
})
};
fetch('https://api.opper.ai/v3/compat/v1/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"content": [
"<unknown>"
],
"id": "<string>",
"model": "<string>",
"role": "<string>",
"stop_reason": "<string>",
"stop_sequence": "<string>",
"type": "<string>",
"usage": {
"input_tokens": 123,
"output_tokens": 123,
"cache_creation_input_tokens": 123,
"cache_read_input_tokens": 123,
"server_tool_use": {}
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}Authorizations
API key authentication. Pass your API key as a Bearer token.
Headers
Function name for tracing and project-level guardrail function-scope filtering.
Parent span ID for distributed tracing context.
Comma-separated key:value usage-attribution tags (e.g. tenant:acme,project:demo, max 8). Recorded on the generation's billing/metrics rows; group spend by any key via GET /v2/analytics/usage?group_by=. Header-borne twin of the /v3/session URL prefix tags (which win per key when both are present); opper.-prefixed keys and session_id are reserved. Malformed values return 400.
Body
Show child attributes
Show child attributes
Opt in to top-level automatic prompt caching: {"type":"ephemeral"} (optionally "ttl":"1h"). Places one moving breakpoint on the largest cacheable prefix. Explicit per-block cache_control on system/message/tool content takes precedence. Caching is off unless set. Cache writes cost 1.25x input and reads 0.1x
Any value
Any value
Any value
Show child attributes
Show child attributes