Tạo text completion (legacy)

Tạo text completion (legacy). Tương thích với [OpenAI Completions API](https://platform.openai.com/docs/api-reference/completions). > **Legacy:** Endpoint này yêu cầu model có `mode: completion` (ví dụ: `gpt-3.5-turbo-instruct`). Hiện tại Trạm AI chưa deploy model nào với mode này. Hãy dùng `/v1/chat/completions` thay thế.

Authentication

AuthorizationBearer
API key làm bearer token. Tạo API key tại [Console](https://console.staging.tram.ai.vn/keys).

Request

This endpoint expects an object.
modelstringRequired

Model ID (yêu cầu model có mode: completion)

promptstringRequired
Text prompt
streambooleanOptionalDefaults to false

Bật streaming (SSE)

temperaturedoubleOptional0-2

Sampling temperature (0–2)

max_tokensintegerOptional

Số token tối đa trong response

top_pdoubleOptional0-1
Nucleus sampling
stopstring or list of stringsOptional
Stop sequences

Response

Thành công

idstring
objectstring
createdinteger
modelstring
choiceslist of objects
usageobject

Errors

400
Bad Request Error
401
Unauthorized Error
403
Forbidden Error
429
Too Many Requests Error