Skip to main content
POST
/
v3
/
compat
/
chat
/
completions
Chat completions
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)
{
  "choices": [
    {
      "finish_reason": "<string>",
      "index": 123,
      "message": {
        "content": "<string>",
        "role": "<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
  }
}

Authorizations

Authorization
string
header
required

API key authentication. Pass your API key as a Bearer token.

Body

application/json
messages
object[]
required
max_completion_tokens
integer
max_tokens
integer
model
string
output_schema
object
reasoning_effort
string
response_format
object
stop
string[]
stream
boolean
stream_options
object
temperature
number
tool_choice
any

Any value

tools
object[]
top_p
number

Response

Successful response

choices
object[]
required
created
integer
required
id
string
required
model
string
required
object
string
required
usage
object
required