Jiniu AIJiniu AI
Docs
Completions

Native OpenAI format

Create a text completion from the given prompt

POST
/v1/completions

Request Body

application/json

model*string

Model name; must match the identifier in the model catalog exactly

prompt*string|

Prompt

max_tokens?integer

Maximum tokens for this generation, useful for capping cost

temperature?number

Sampling temperature. Higher values give more varied output; typically 0–2. Tune this or top_p, not both

top_p?number

Nucleus sampling: sample only from candidates within this cumulative probability. Tune this or temperature, not both

n?integer

Number of results to generate. Billing counts the usage of all of them

stream?boolean

Whether to stream the response over SSE

stop?string|

Stop sequences; generation ends as soon as one is produced

suffix?string

Text appended after the completion

echo?boolean

Whether to echo the prompt back in the response

Response Body

application/json

curl -X POST "https://jiniu.ai/v1/completions" \  -H "Content-Type: application/json" \  -d '{    "model": "string",    "prompt": "string"  }'
{
  "id": "string",
  "object": "text_completion",
  "created": 0,
  "model": "string",
  "choices": [
    {
      "text": "string",
      "index": 0,
      "finish_reason": "string"
    }
  ],
  "usage": {
    "prompt_tokens": 0,
    "completion_tokens": 0,
    "total_tokens": 0,
    "prompt_tokens_details": {
      "cached_tokens": 0,
      "text_tokens": 0,
      "audio_tokens": 0,
      "image_tokens": 0
    },
    "completion_tokens_details": {
      "text_tokens": 0,
      "audio_tokens": 0,
      "reasoning_tokens": 0
    }
  }
}