Skip to main content
POST
Create text completion
这是一个旧版端点。对于大多数用例,请使用 Chat Completions 代替。

请求体

string
必填
要使用的模型 ID。
string | string[]
必填
要生成补全的提示词。
integer
默认值:16
要生成的最大 token 数。
number
默认值:1
采样温度,范围 0 到 2。
number
默认值:1
核采样参数。
string | string[]
停止序列。
string
附加在补全后的文本。

响应

示例

授权

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 text completion (legacy).

model
string
必填

ID of the model to use.

prompt
必填

The prompt(s) to generate completions for.

max_tokens
integer

The maximum number of tokens to generate.

temperature
number

Sampling temperature between 0 and 2.

top_p
number

Nucleus sampling parameter.

n
integer

How many completions to generate for each prompt.

stream
boolean
默认值:false

Whether to stream back partial progress via SSE.

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.

presence_penalty
number

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

logit_bias
object

Modify the likelihood of specified tokens appearing in the completion.

suffix
string

The suffix that comes after a completion of inserted text.

user
string

A unique identifier representing your end-user.

routing
object

Configuration for intelligent request routing.

响应

Text completion response.

Response from a text completion request.

id
string

A unique identifier for the completion.

object
enum<string>

The object type, always 'text_completion'.

可用选项:
text_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.

openmodex
object

OpenModex-specific metadata included in completion responses.