Documentation

Chat completions

POST
/api/v1/external/inference/chat/completions

Generates a response from a model or agent based on the provided chat messages. Model key DTO will be 100% OpenAI SDK compatible, whereas Agent key DTO is more limited since agent config is already being used.

AutorisationBearer <jeton>

Clé API d'organisation (model key ou agent key), créée depuis la console Oreus ou l'API Third-Party. Ce n'est pas le jeton OIDC.

Dans: header

Paramètres d’en-tête

x-oreus-user-authorization?string

Optionnel. Bearer <JWT d'organisation> de l'utilisateur connecté, obtenu via le flow OIDC avec les scopes read:inference / write:inference. Présent, l'appel est facturé à cet utilisateur en orbs plutôt qu'à l'organisation propriétaire de la clé API. Le jeton doit avoir été émis pour une application third-party de la même organisation que la clé.

Corps de requête

application/json

Choose the schema matching your API key type. With a Model key the body is OpenAI compatible and proxied to liteLLM untouched, so any parameter of the OpenAI chat completion API is accepted even though only the common ones are listed here; validation is handled by the upstream provider. With an Agent key, only messages, model (the agent id), stream and files are used.

Définitions TypeScript

Utilisez le type request body en TypeScript.

messages*array<>

Liste des messages de la conversation

model*string

Should also be used to specify agent when using agent API key

stream?boolean

Stream the response as server-sent events

temperature?number

Sampling temperature

max_completion_tokens?number

Maximum number of tokens to generate

top_p?number

Nucleus sampling probability mass

frequency_penalty?number

Penalise tokens by their frequency so far

presence_penalty?number

Penalise tokens that already appeared

stop?array<string>

Sequences where generation stops

files*array<array<>>
stream_options?

Corps de réponse

application/json

curl -X POST "https://example.com/api/v1/external/inference/chat/completions" \  -H "Content-Type: application/json" \  -d '{    "model": "model-id",    "messages": [      {        "role": "user",        "content": "Hello!"      }    ],    "stream": false  }'
{  "id": "chatcmpl-abc123",  "object": "chat.completion",  "created": 1699017600,  "model": "gpt-4",  "choices": [    {      "index": 0,      "message": {        "role": "assistant",        "content": "Response text here",        "refusal": null,        "annotations": []      },      "finish_reason": "stop",      "logprobs": null    }  ],  "usage": {    "prompt_tokens": 10,    "completion_tokens": 20,    "total_tokens": 30,    "prompt_tokens_details": {      "cached_tokens": 0,      "audio_tokens": 0    },    "completion_tokens_details": {      "reasoning_tokens": 0,      "audio_tokens": 0,      "accepted_prediction_tokens": 0,      "rejected_prediction_tokens": 0    }  },  "service_tier": "default"}