POST
https://octopusx.ai
/
v1
/
completions
curl -X POST https://octopusx.ai/v1/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-3.5-turbo-instruct",
    "prompt": "把下面一句话改写得更正式:这个接口挺好用。",
    "max_tokens": 120,
    "temperature": 0.3
  }'
{
  "id": "cmpl_abc123",
  "object": "text_completion",
  "created": 1735689600,
  "model": "gpt-3.5-turbo-instruct",
  "choices": [
    {
      "index": 0,
      "text": "该接口具备良好的易用性。",
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 22,
    "completion_tokens": 10,
    "total_tokens": 32
  }
}

Text Completion API

The Legacy Completions API uses prompt as input and is suitable for businesses still using the old OpenAI SDK or simple text completion workflows. For new conversational scenarios, it is recommended to use the chat completions API.

Request Body

model
string
required
Model name.
prompt
string | array<string>
required
Input prompt.
stream
boolean
Whether to enable streaming output.
max_tokens
integer
Maximum number of tokens to generate.
temperature
number
Sampling temperature.
top_p
number
Nucleus sampling parameter.
stop
string | array<string>
Stop sequences.

Request Example

curl -X POST https://octopusx.ai/v1/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-3.5-turbo-instruct",
    "prompt": "把下面一句话改写得更正式:这个接口挺好用。",
    "max_tokens": 120,
    "temperature": 0.3
  }'

Response Example

{
  "id": "cmpl_abc123",
  "object": "text_completion",
  "created": 1735689600,
  "model": "gpt-3.5-turbo-instruct",
  "choices": [
    {
      "index": 0,
      "text": "该接口具备良好的易用性。",
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 22,
    "completion_tokens": 10,
    "total_tokens": 32
  }
}