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.
Autorisation
bearer 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
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.
Liste des messages de la conversation
Should also be used to specify agent when using agent API key
Stream the response as server-sent events
Sampling temperature
Maximum number of tokens to generate
Nucleus sampling probability mass
Penalise tokens by their frequency so far
Penalise tokens that already appeared
Sequences where generation stops
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"}