Skip to content

Completions(舊版)

採用舊版 Completions 協議格式。新程式碼請使用 Chat Completions;保留此介面僅為向下相容遺留整合。

POST https://wrouter.ai/v1/completions

請求體

引數型別必填說明
modelstring例如 gpt-3.5-turbo-instructdavinci-002
promptstring | string[]輸入文本
max_tokensinteger
temperaturenumber
top_pnumber
ninteger
streamboolean
stopstring | string[]
suffixstring
echoboolean

響應

json
{
  "id": "cmpl-xxx",
  "object": "text_completion",
  "created": 1718000000,
  "model": "gpt-3.5-turbo-instruct",
  "choices": [{"text": "...", "index": 0, "finish_reason": "stop"}],
  "usage": {"prompt_tokens": 5, "completion_tokens": 7, "total_tokens": 12}
}

示例

bash
curl https://wrouter.ai/v1/completions \
  -H "Authorization: Bearer $WROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-3.5-turbo-instruct","prompt":"hello, ","max_tokens":16}'