BetopiaAIBETA
API Referencev1

Betopia API

Use your Betopia API key to call LLM models directly. The API is OpenAI-compatible — swap the base URL and key and existing integrations work immediately.

Base URL: https://api.betopia.ai

Chat Completions

POST/v1/chat/completions

Send a list of messages and receive a completion. Supports system, user, and assistant roles. Add "stream": true for SSE — see . Set "model": "auto" to let the router pick the best eligible model — see .

python
import requests

API_KEY  = "sk_your_api_key_here"
BASE_URL = "https://api.betopia.ai"

response = requests.post(
    f"{BASE_URL}/v1/chat/completions",
    headers={
        "Authorization": f"Bearer {API_KEY}",
        "Content-Type": "application/json",
    },
    json={
        "model": "gpt-5.4-mini",
        "messages": [
            {"role": "system", "content": "You are a helpful assistant."},
            {"role": "user",   "content": "Explain quantum computing in simple terms."},
        ],
        "max_completion_tokens": 512,
        "temperature": 0.7,
    },
)

data = response.json()
print(data["choices"][0]["message"]["content"])
print(f"Tokens: {data['usage']['prompt_tokens']} in / {data['usage']['completion_tokens']} out")

Response

response
{
  "object": "chat.completion",
  "model":  "gpt-5.4-mini",
  "choices": [{
    "message": {
      "role":    "assistant",
      "content": "Quantum computing uses quantum bits (qubits) that can exist in multiple states at once..."
    },
    "finish_reason": "stop"
  }],
  "usage": {
    "prompt_tokens":     24,
    "completion_tokens": 187,
    "total_tokens":      211
  }
}
objectstringAlways "chat.completion"
modelstringModel that processed the request
choices[].message.contentstringGenerated text response
choices[].finish_reasonstring"stop", or "tool_calls" — see Tool Calling
usage.prompt_tokensintegerTokens consumed by your prompt
usage.completion_tokensintegerTokens in the generated response
usage.total_tokensintegerSum of prompt + completion tokens