Skip to main content
POST
Create text completion
Đây là endpoint cũ. Đối với hầu hết các trường hợp sử dụng, hãy sử dụng Hoàn thành Chat thay thế.

Thân Yêu Cầu

string
bắt buộc
ID mô hình để sử dụng.
string | string[]
bắt buộc
(Các) prompt để tạo hoàn thành.
integer
mặc định:16
Số lượng token tối đa để tạo.
number
mặc định:1
Nhiệt độ lấy mẫu từ 0 đến 2.
number
mặc định:1
Tham số lấy mẫu nucleus.
string | string[]
(Các) chuỗi dừng.
string
Văn bản để thêm vào sau phần hoàn thành.

Phản Hồi

Ví Dụ

Ủy quyền

Authorization
string
header
bắt buộc

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

Nội dung

application/json

Request body for creating a text completion (legacy).

model
string
bắt buộc

ID of the model to use.

prompt
bắt buộc

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
mặc định: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.

Phản hồi

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'.

Tùy chọn có sẵn:
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.