Skip to main content
POST
Create chat completion

요청 본문

string
필수
사용할 모델 ID (예: gpt-4o, claude-3.5-sonnet, gemini-2.0-flash).
array
필수
대화를 구성하는 메시지 목록입니다.
boolean
기본값:false
true이면 Server-Sent Events (SSE) 스트림을 반환합니다.
number
기본값:1
0에서 2 사이의 샘플링 온도입니다. 낮은 값은 더 결정적입니다.
integer
생성할 최대 토큰 수입니다.
number
기본값:1
핵 샘플링 파라미터입니다.
string | string[]
생성을 중단시키는 정지 시퀀스입니다.
number
기본값:0
토큰 빈도에 대한 페널티입니다 (-2.0에서 2.0).
number
기본값:0
토큰 존재에 대한 페널티입니다 (-2.0에서 2.0).
array
모델이 호출할 수 있는 도구 목록입니다 (function calling).
string | object
어떤 도구를 호출할지 제어합니다. auto, none 또는 특정 도구입니다.
object
특정 출력 형식을 강제합니다 (예: {"type": "json_object"}).
integer
재현성을 위한 결정적 샘플링 시드입니다.

OpenModex 확장

object
이 요청에 대한 지능형 라우팅을 설정합니다.
object
프롬프트 캐싱을 설정합니다.

응답

예제

인증

Authorization
string
header
필수

API key authentication. Pass your OpenModex API key as a Bearer token in the Authorization header: Authorization: Bearer omx_sk_...

본문

application/json

Request body for creating a chat completion.

model
string
필수

ID of the model to use.

messages
object[]
필수

A list of messages comprising the conversation so far.

stream
boolean
기본값:false

If true, partial message deltas will be sent as server-sent events.

temperature
number

Sampling temperature between 0 and 2. Higher values make output more random.

필수 범위: 0 <= x <= 2
top_p
number

Nucleus sampling parameter. Only consider tokens with top_p probability mass.

n
integer

How many completions to generate for each prompt.

max_tokens
integer

The maximum number of tokens to generate in the completion.

stop

Up to 4 sequences where the API will stop generating further tokens.

frequency_penalty
number

Penalizes new tokens based on their existing frequency in the text so far.

필수 범위: -2 <= x <= 2
presence_penalty
number

Penalizes new tokens based on whether they appear in the text so far.

필수 범위: -2 <= x <= 2
logit_bias
object

Modify the likelihood of specified tokens appearing in the completion. Maps token IDs to bias values from -100 to 100.

tools
object[]

A list of tools the model may call.

tool_choice

Controls which tool is called by the model. Can be 'none', 'auto', 'required', or a specific tool object.

response_format
object

An object specifying the format the model must output (e.g., {"type": "json_object"}).

seed
integer

If specified, the system will attempt to sample deterministically.

user
string

A unique identifier representing your end-user, for abuse monitoring.

routing
object

Configuration for intelligent request routing.

cache
object

Configuration for response caching.

응답

Chat completion response. When stream=true, returns SSE stream of ChatCompletionChunk objects.

Response from a chat completion request.

id
string

A unique identifier for the completion.

object
enum<string>

The object type, always 'chat.completion'.

사용 가능한 옵션:
chat.completion
created
integer

Unix timestamp (in seconds) of when the completion was created.

model
string

The model used for the completion.

choices
object[]

A list of completion choices.

usage
object

Token usage statistics for a completion request.

system_fingerprint
string

A fingerprint representing the backend configuration.

openmodex
object

OpenModex-specific metadata included in completion responses.