İçeriğe geç
Gurubase Siper
English
Esc
navigateopen⌘Jpreview

Chat Completions (OpenAI compatible)

Compatible with OpenAI POST /v1/chat/completions. The messages content in the request body is masked for PII before the model is called. SSE streaming is supported with stream: true.

POST/v1/chat/completions
Request body
requiredapplication/json
modelstringrequired
Target model identifier (defined in the panel).
messagesChatMessage[]required
min items 1
Show properties
Array of ChatMessage
rolestringrequired
Allowed:systemuserassistanttool
contentstringrequired
Message text. By default, personal data in the content of all roles (`system`, `user`, `assistant`, `tool`) is masked inside the gateway; only the masked form reaches the model.
streamboolean
If true, the response is returned as an SSE stream.
default: false
temperaturenumber
min 0 · max 2 · default: 1
max_tokensinteger
Maximum number of tokens to generate.
min 1
top_pnumber
min 0 · max 1
Responses
200Successful response
idstring
objectstring
createdinteger
modelstring
choicesChatChoice[]
Show properties
Array of ChatChoice
indexinteger
finish_reasonstring
messageChatMessage
Show properties
rolestringrequired
Allowed:systemuserassistanttool
contentstringrequired
Message text. By default, personal data in the content of all roles (`system`, `user`, `assistant`, `tool`) is masked inside the gateway; only the masked form reaches the model.
usageUsage
Show properties
prompt_tokensinteger
completion_tokensinteger
total_tokensinteger
401Missing or invalid virtual key
errorobject
Show properties
messagestring
typestring
429Quota or rate limit exceeded
errorobject
Show properties
messagestring
typestring
Request
from openai import OpenAI

client = OpenAI(
    base_url="https://gw-tr.gurubase.io/v1",
    api_key="SANAL_ANAHTAR",
)

resp = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[
        {"role": "user", "content": "Ayşe Demir'in talebini özetle."},
    ],
)
print(resp.choices[0].message.content)
Response
{
  "id": "chatcmpl-abc123",
  "object": "chat.completion",
  "created": 1718000000,
  "model": "gpt-4o-mini",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "role": "system",
        "content": "string"
      }
    }
  ],
  "usage": {
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0
  }
}