채팅 (텍스트)
스트리밍 여부, 도구 사용 여부와 관계없이 이용 가능한 대화 완성 기능.
요청
http
POST /v1/chat/completionsjson
{
"messages": [
{ "role": "user", "content": "Explique le routage IA en une phrase." }
],
"model": null,
"routing_strategy": "auto",
"max_tokens": null,
"temperature": null,
"stream": false,
"tools": null,
"tool_choice": null
}messages만 필수입니다. model과 routing_strategy는 라우팅 및 장애 조치에서 설명합니다.
응답
json
{
"content": "Le routage IA choisit automatiquement le meilleur fournisseur disponible pour chaque appel.",
"finish_reason": "stop",
"model": "claude-opus-5",
"provider": "anthropic",
"input_tokens": 12,
"output_tokens": 18,
"tool_calls": null
}스트리밍
"stream": true를 전달하면 단일 JSON 블록 대신 Server-Sent Events 형식으로 응답을 받을 수 있습니다.
typescript
for await (const chunk of client.chat.completions.stream({
messages: [{ role: "user", content: "Compte jusqu'a 10." }],
})) {
process.stdout.write(chunk.delta);
}도구 호출 (Function Calling)
tools(표준 JSON Schema 형식의 정의)를 제공하면 모델이 텍스트 대신(또는 텍스트와 함께) tool_calls로 응답할 수 있습니다. 대화를 계속하려면 역할이 "tool"인 메시지에 해당 tool_call_id와 함께 결과를 반환하세요.
json
{
"messages": [
{ "role": "user", "content": "Quel temps fait-il a Paris ?" },
{
"role": "assistant",
"content": "",
"tool_calls": [
{ "id": "call_1", "name": "get_weather", "arguments": { "city": "Paris" } }
]
},
{ "role": "tool", "tool_call_id": "call_1", "content": "18C, nuageux" }
],
"tools": [
{
"name": "get_weather",
"description": "Meteo actuelle d'une ville.",
"parameters": {
"type": "object",
"properties": { "city": { "type": "string" } },
"required": ["city"]
}
}
]
}자동화된 다중 턴 오케스트레이션(서버가 각 도구 결과 후 모델을 다시 호출하고 장기 기억을 유지)이 필요하다면, 루프를 직접 관리하는 대신 AI 에이전트 가이드를 참고하세요.
호환 모델
Anthropic(Claude), OpenAI(GPT), Google(Gemini), DeepSeek, xAI(Grok), Mistral, Moonshot, MiniMax, Meta — 정확하고 최신인 목록은 카탈로그를 통해 확인할 수 있습니다:
bash
GET /v1/models?category=text