K-EXAONE 2.5
POST /v1/chat/completions
EXAONE API Platform을 통해 K-EXAONE 2.5 모델을 호출할 수 있습니다. EXAONE API는 OpenAI Compatible API를 지원합니다.
K-EXAONE 2.5는 텍스트 전용 모델입니다.
최대 Context length는 524,288 토큰입니다. 입력 토큰 수와 max_tokens 의 합이 이 값을 넘으면 400 에러를 반환합니다.
요청 정보
| Field | Type | Description | Required |
|---|---|---|---|
| model | string | k-exaone_v2.5 | mandatory |
| messages | array<object> | 대화 메시지 목록 | mandatory |
| messages[].role | string | system / user / assistant | mandatory |
| messages[].content | string | 프롬프트 / 질의 / 답변 | mandatory |
| max_tokens | int | 생성할 최대 토큰 수 (추론 과정 포함). 입력 토큰 수 + max_tokens ≤ 524,288 | optional |
| stream | boolean | 답변의 스트리밍 여부 (default: false) | optional |
| stream_options.include_usage | boolean | 스트리밍 응답의 마지막에 토큰 사용량(usage) 청크 포함 여부. stream: true 일 때만 사용 가능 (default: false) | optional |
| temperature | float | 확률 분포의 '뾰족함'을 조절하여 답변의 무작위성을 결정. 범위: 0.0 ~ inf, 클수록 무작위성 커짐 (default: 1.0) | optional |
| top_p | float | 누적 확률 합이 p 이하인 상위 토큰 후보만 채택. 범위: 0.0 ~ 1.0 (default: 0.95) | optional |
| top_k | int | 가장 확률이 높은 상위 k개 토큰 후보만 채택. 범위: -1 또는 1 ~ N, -1 설정 시 필터링 비활성화 (default: -1) | optional |
| presence_penalty | float | 이미 출현한 단어에 감점을 주어 반복 방지 및 새로운 주제 도입 유도. 범위: -2.0 ~ 2.0, 양수면 동일 토큰 발생 확률을 낮춤 (default: 0.0) | optional |
| reasoning_effort | string | 추론(thinking) 강도. low / high / max , 높을수록 추론을 길게 수행 (default: max) | optional |
| chat_template_kwargs.preserve_thinking | boolean | 멀티턴 대화에서 이전 assistant 턴의 추론 과정을 입력에 남길지 여부. false 면 마지막 유저 메시지 이후의 추론만 유지 (default: false) | optional |
응답 정보(stream: false)
| Field | Type | Description |
|---|---|---|
| body | object | OpenAI 표준 출력 방식의 Chat Completion Object |
응답 정보(stream: true)
| Field | Type | Description |
|---|---|---|
| data | string | SSE 기반 OpenAI Chat Completion Chunk |
요청 예제(stream: false)
curl 'https://api.exaone.ai/v1/chat/completions' \
-H "Authorization: Bearer $EXAONE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "k-exaone_v2.5",
"max_tokens": 512,
"messages": [
{
"role": "user",
"content": "Hi, EXAONE"
}
],
"stream": false
}'import requests
url = "https://api.exaone.ai/v1/chat/completions"
headers = {
"Authorization": f"Bearer {EXAONE_API_KEY}",
"Content-Type": "application/json",
}
payload = {
"model": "k-exaone_v2.5",
"messages": [{"role": "user", "content": "Hi, EXAONE"}],
"stream": False,
}
response = requests.post(url=url, headers=headers, json=payload)
print(response.text)(async () => {
const url = 'https://api.exaone.ai/v1/chat/completions';
const headers = {
Authorization: `Bearer ${process.env.EXAONE_API_KEY}`,
'Content-Type': 'application/json',
};
const payload = {
model: 'k-exaone_v2.5',
max_tokens: 512,
messages: [{ role: 'user', content: 'Hi, EXAONE' }],
stream: false,
};
try {
const response = await fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(payload),
});
console.log(await response.text());
} catch (error) {
console.error('Error:', error);
}
})();응답 예제(stream: false)
{
"id": "1f30a3635ebd4e4cb57e4d41e2f18d55",
"choices": [
{
"finish_reason": "stop",
"index": 0,
"logprobs": null,
"message": {
"content": "\n\nHello! How can I help you today?",
"refusal": null,
"role": "assistant",
"annotations": null,
"audio": null,
"function_call": null,
"tool_calls": null,
"reasoning_content": "We need answer to user \"Hi, EXAONE\". We are AI assistant accessed via API. Need respond. We shouldn't claim EXAONE? We are likely not EXAONE, unless system? The system prompt is how am I supposed to behave, no identity. User says Hi, EXAONE. We can greet back, maybe clarify: I'm EXAONE? Need be honest. We are not necessarily called EXAONE. However no explicit model identity. In API, maybe they are addressing assistant. We can say \"Hi! I'm an AI assistant. How can I help?\" If this is a test? They said \"Hi, EXAONE\", maybe expect assistant to identify as EXAONE? We need not misrepresent. If team? There is no identity, so safest: \"Hi! I don't have a name, but happy to help.\" But user might be talking to EXAONE model (LG AI Research). We shouldn't claim if not. Maybe \"Hello! How can I assist you today?\" Simple. Could mention \"I can try.\" Since asked just hi, no need. Final answer.\n"
},
"matched_stop": 53
}
],
"created": 1793945790,
"model": "k-exaone_v2.5",
"object": "chat.completion",
"metadata": {
"weight_version": "default",
"weight_versions": [{ "version": "default", "start": 0, "end": 218 }]
},
"moderation": null,
"service_tier": null,
"system_fingerprint": null,
"usage": {
"completion_tokens": 218,
"prompt_tokens": 22,
"total_tokens": 240,
"completion_tokens_details": null,
"prompt_tokens_details": null,
"reasoning_tokens": 209
}
}요청 예제(stream: true)
curl 'https://api.exaone.ai/v1/chat/completions' \
-H "Authorization: Bearer $EXAONE_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"model": "k-exaone_v2.5",
"max_tokens": 512,
"messages": [
{
"role": "user",
"content": "Hi, EXAONE"
}
],
"stream": true
}'import requests
url = "https://api.exaone.ai/v1/chat/completions"
headers = {
"Authorization": f"Bearer {EXAONE_API_KEY}",
"Content-Type": "application/json",
}
payload = {
"model": "k-exaone_v2.5",
"max_tokens": 512,
"messages": [{"role": "user", "content": "Hi, EXAONE"}],
"stream": True,
}
with requests.post(url=url, headers=headers, json=payload, stream=True) as response:
for line in response.iter_lines(decode_unicode=True):
if line:
print(line)(async () => {
const url = 'https://api.exaone.ai/v1/chat/completions';
const headers = {
Authorization: `Bearer ${process.env.EXAONE_API_KEY}`,
'Content-Type': 'application/json',
};
const payload = {
model: 'k-exaone_v2.5',
max_tokens: 512,
messages: [{ role: 'user', content: 'Hi, EXAONE' }],
stream: true,
};
try {
const response = await fetch(url, {
method: 'POST',
headers: headers,
body: JSON.stringify(payload),
});
const decoder = new TextDecoder();
for await (const chunk of response.body) {
process.stdout.write(decoder.decode(chunk, { stream: true }));
}
} catch (error) {
console.error('Error:', error);
}
})();응답 예제(stream: true)
data: {"id": "2fa2bf0467cf4d758fe4c4dba28f2b18", "choices": [{"delta": {"content": "", "role": "assistant"}, "index": 0}], "created": 1793947427, "model": "k-exaone_v2.5", "object": "chat.completion.chunk"}
data: {"id": "2fa2bf0467cf4d758fe4c4dba28f2b18", "choices": [{"delta": {"reasoning_content": "We"}, "index": 0}], "created": 1793947427, "model": "k-exaone_v2.5", "object": "chat.completion.chunk"}
data: {"id": "2fa2bf0467cf4d758fe4c4dba28f2b18", "choices": [{"delta": {"reasoning_content": " need"}, "index": 0}], "created": 1793947427, "model": "k-exaone_v2.5", "object": "chat.completion.chunk"}
data: {"id": "2fa2bf0467cf4d758fe4c4dba28f2b18", "choices": [{"delta": {"reasoning_content": " answer to"}, "index": 0}], "created": 1793947427, "model": "k-exaone_v2.5", "object": "chat.completion.chunk"}
data: {"id": "2fa2bf0467cf4d758fe4c4dba28f2b18", "choices": [{"delta": {"reasoning_content": " user. They said \"Hi"}, "index": 0}], "created": 1793947427, "model": "k-exaone_v2.5", "object": "chat.completion.chunk"}
...
data: {"id": "2fa2bf0467cf4d758fe4c4dba28f2b18", "choices": [{"delta": {"content": "how"}, "index": 0}], "created": 1793947427, "model": "k-exaone_v2.5", "object": "chat.completion.chunk"}
data: {"id": "2fa2bf0467cf4d758fe4c4dba28f2b18", "choices": [{"delta": {"content": " can I help you today? 😊"}, "index": 0}], "created": 1793947427, "model": "k-exaone_v2.5", "object": "chat.completion.chunk"}
data: {"id": "2fa2bf0467cf4d758fe4c4dba28f2b18", "choices": [{"delta": {}, "finish_reason": "stop", "index": 0, "matched_stop": 53}], "created": 1793947427, "model": "k-exaone_v2.5", "object": "chat.completion.chunk"}
data: {"id": "2fa2bf0467cf4d758fe4c4dba28f2b18", "choices": [], "created": 1793947427, "model": "k-exaone_v2.5", "object": "chat.completion.chunk", "usage": {"completion_tokens": 234, "prompt_tokens": 22, "total_tokens": 256, "reasoning_tokens": 216}}
data: [DONE]