> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gravitex.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Completions

> OpenAI 호환 레거시 텍스트 완성 API

## 소개

`prompt`로부터 텍스트 완성을 생성합니다. OpenAI Completions API와 호환됩니다. 다중 턴 대화에는 [Chat completions](/ko/api-reference/endpoint/chat-openai)를 사용하는 것이 좋습니다.

## 인증

<ParamField header="Authorization" type="string" required>
  Bearer Token, 예: `Bearer sk-xxxxxxxxxx`
</ParamField>

## 요청 매개변수

<ParamField body="model" type="string" required>
  모델 ID
</ParamField>

<ParamField body="prompt" type="string | array" required>
  프롬프트 텍스트(문자열 또는 문자열 배열)
</ParamField>

<ParamField body="max_tokens" type="integer">
  생성할 최대 토큰 수
</ParamField>

<ParamField body="temperature" type="number">
  샘플링 온도
</ParamField>

<ParamField body="stream" type="boolean" default="false">
  SSE를 통한 스트리밍 응답
</ParamField>

## 요청 예시

```bash theme={null}
curl -X POST "https://api.gravitex.ai/v1/completions" \
  -H "Authorization: Bearer sk-xxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-4o-mini",
    "prompt": "In one sentence, describe AI:",
    "max_tokens": 100,
    "temperature": 0.7
  }'
```

## 주요 매개변수

* **model**: 모델 ID
* **prompt**: 입력 프롬프트
* **max\_tokens**: 출력 길이 제한
* **stream**: SSE 스트리밍을 위해 `true`로 설정

전체 요청/응답 스키마는 [OpenAI Completions API](https://platform.openai.com/docs/api-reference/completions)를 참조하세요.
