Chat Completions API
curl --request POST \
--url https://api.opper.ai/v3/compat/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"content": "<unknown>",
"role": "<string>",
"name": "<string>",
"tool_call_id": "<string>",
"tool_calls": [
{
"function": {
"arguments": "<string>",
"name": "<string>"
},
"id": "<string>",
"type": "<string>",
"thought_signature": "<string>"
}
]
}
]
}
'import requests
url = "https://api.opper.ai/v3/compat/chat/completions"
payload = { "messages": [
{
"content": "<unknown>",
"role": "<string>",
"name": "<string>",
"tool_call_id": "<string>",
"tool_calls": [
{
"function": {
"arguments": "<string>",
"name": "<string>"
},
"id": "<string>",
"type": "<string>",
"thought_signature": "<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({
messages: [
{
content: '<unknown>',
role: '<string>',
name: '<string>',
tool_call_id: '<string>',
tool_calls: [
{
function: {arguments: '<string>', name: '<string>'},
id: '<string>',
type: '<string>',
thought_signature: '<string>'
}
]
}
]
})
};
fetch('https://api.opper.ai/v3/compat/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"choices": [
{
"finish_reason": "<string>",
"index": 123,
"message": {
"content": "<string>",
"role": "<string>",
"annotations": [
{
"type": "<string>",
"url_citation": {
"url": "<string>",
"content": "<string>",
"end_index": 123,
"start_index": 123,
"title": "<string>"
}
}
],
"reasoning_content": "<string>",
"tool_calls": [
{
"function": {
"arguments": "<string>",
"name": "<string>"
},
"id": "<string>",
"type": "<string>",
"thought_signature": "<string>"
}
]
}
}
],
"created": 123,
"id": "<string>",
"model": "<string>",
"object": "<string>",
"usage": {
"completion_tokens": 123,
"prompt_tokens": 123,
"total_tokens": 123,
"completion_tokens_details": {
"reasoning_tokens": 123
},
"prompt_tokens_details": {
"cache_creation_1h_tokens": 123,
"cache_creation_tokens": 123,
"cached_tokens": 123
},
"server_tool_use": {}
},
"cost": 123,
"meta": {
"guards": [
{
"flagged": true,
"type": "<string>",
"code": "<string>",
"findings": [
"<unknown>"
],
"phase": "<string>",
"rule_id": "<string>",
"rule_name": "<string>",
"scope_type": "<string>",
"status": "<string>"
}
],
"trace_uuid": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}{
"error": {
"code": "<string>",
"message": "<string>",
"details": "<unknown>"
},
"meta": {}
}OpenAI
Chat Completions
OpenAI-compatible chat completions endpoint. Supports streaming via the stream parameter.
POST
/
v3
/
compat
/
chat
/
completions
Chat Completions API
curl --request POST \
--url https://api.opper.ai/v3/compat/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"messages": [
{
"content": "<unknown>",
"role": "<string>",
"name": "<string>",
"tool_call_id": "<string>",
"tool_calls": [
{
"function": {
"arguments": "<string>",
"name": "<string>"
},
"id": "<string>",
"type": "<string>",
"thought_signature": "<string>"
}
]
}
]
}
'import requests
url = "https://api.opper.ai/v3/compat/chat/completions"
payload = { "messages": [
{
"content": "<unknown>",
"role": "<string>",
"name": "<string>",
"tool_call_id": "<string>",
"tool_calls": [
{
"function": {
"arguments": "<string>",
"name": "<string>"
},
"id": "<string>",
"type": "<string>",
"thought_signature": "<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({
messages: [
{
content: '<unknown>',
role: '<string>',
name: '<string>',
tool_call_id: '<string>',
tool_calls: [
{
function: {arguments: '<string>', name: '<string>'},
id: '<string>',
type: '<string>',
thought_signature: '<string>'
}
]
}
]
})
};
fetch('https://api.opper.ai/v3/compat/chat/completions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"choices": [
{
"finish_reason": "<string>",
"index": 123,
"message": {
"content": "<string>",
"role": "<string>",
"annotations": [
{
"type": "<string>",
"url_citation": {
"url": "<string>",
"content": "<string>",
"end_index": 123,
"start_index": 123,
"title": "<string>"
}
}
],
"reasoning_content": "<string>",
"tool_calls": [
{
"function": {
"arguments": "<string>",
"name": "<string>"
},
"id": "<string>",
"type": "<string>",
"thought_signature": "<string>"
}
]
}
}
],
"created": 123,
"id": "<string>",
"model": "<string>",
"object": "<string>",
"usage": {
"completion_tokens": 123,
"prompt_tokens": 123,
"total_tokens": 123,
"completion_tokens_details": {
"reasoning_tokens": 123
},
"prompt_tokens_details": {
"cache_creation_1h_tokens": 123,
"cache_creation_tokens": 123,
"cached_tokens": 123
},
"server_tool_use": {}
},
"cost": 123,
"meta": {
"guards": [
{
"flagged": true,
"type": "<string>",
"code": "<string>",
"findings": [
"<unknown>"
],
"phase": "<string>",
"rule_id": "<string>",
"rule_name": "<string>",
"scope_type": "<string>",
"status": "<string>"
}
],
"trace_uuid": "<string>"
}
}{
"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.
Body
application/json
Show child attributes
Show child attributes
Opt in to automatic prompt caching for Anthropic-family models: {"type":"ephemeral"} (optionally "ttl":"1h"). Places one moving cache breakpoint on the largest cacheable prefix. Also settable per content part for precise placement. Caching is off unless set; no-op on providers with automatic server-side caching (OpenAI
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Any value
Show child attributes
Show child attributes
⌘I