跳转到主要内容
POST
/
v1
/
completions
创建文本补全
curl --request POST \
  --url https://api.ldx.dev/v1/completions \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "<string>",
  "prompt": "<string>",
  "max_tokens": 123,
  "temperature": 123,
  "top_p": 123,
  "n": 123,
  "stream": true,
  "stop": "<string>",
  "suffix": "<string>",
  "echo": true
}
'
{
  "id": "<string>",
  "object": "text_completion",
  "created": 123,
  "model": "<string>",
  "choices": [
    {
      "text": "<string>",
      "index": 123,
      "finish_reason": "<string>"
    }
  ],
  "usage": {
    "prompt_tokens": 123,
    "completion_tokens": 123,
    "total_tokens": 123,
    "prompt_tokens_details": {
      "cached_tokens": 123,
      "text_tokens": 123,
      "audio_tokens": 123,
      "image_tokens": 123
    },
    "completion_tokens_details": {
      "text_tokens": 123,
      "audio_tokens": 123,
      "reasoning_tokens": 123
    }
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.liandanxia.io/llms.txt

Use this file to discover all available pages before exploring further.

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

请求体

application/json
model
string
必填
prompt
必填
max_tokens
integer
temperature
number
top_p
number
n
integer
stream
boolean
stop
suffix
string
echo
boolean

响应

200 - application/json

成功创建响应

id
string
object
string
示例:

"text_completion"

created
integer
model
string
choices
object[]
usage
object