SoxAIDocs
API Reference

Completions (Legacy)

POST /v1/completions — legacy text completion endpoint

Completions (Legacy)

POST /v1/completions

The legacy text completion endpoint. This endpoint takes a prompt string and returns a completion. Most modern models are optimized for chat format — use Chat Completions for new applications.

Request Body

ParameterTypeRequiredDescription
modelstringYesModel ID. The gateway accepts any chat model here; the legacy prompt/completion shape is transformed internally.
promptstring or arrayYesInput prompt(s)
max_tokensintegerNoMaximum tokens to generate. Default: 16
temperaturenumberNoSampling temperature 0–2. Default: 1
top_pnumberNoNucleus sampling probability
nintegerNoNumber of completions per prompt
streambooleanNoStream tokens via SSE
stopstring or arrayNoStop sequences
echobooleanNoEcho the prompt in the response
suffixstringNoSuffix appended after the completion

Example Request

curl https://api.soxai.io/v1/completions \
  -H "Authorization: Bearer $SOXAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.4-nano",
    "prompt": "Write a haiku about the ocean:",
    "max_tokens": 60,
    "temperature": 0.8
  }'

Example Response

{
  "id": "cmpl-01jq4xyz",
  "object": "text_completion",
  "created": 1743350400,
  "model": "gpt-5.4-nano",
  "choices": [
    {
      "text": "\nWaves crash on the shore,\nSalt and foam rise and recede,\nOcean breathes in peace.",
      "index": 0,
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 9,
    "completion_tokens": 22,
    "total_tokens": 31
  }
}

Migration to Chat Completions

The completions endpoint is maintained for backward compatibility. For equivalent functionality using Chat Completions:

{
  "model": "gpt-5.4-mini",
  "messages": [
    {"role": "user", "content": "Write a haiku about the ocean:"}
  ]
}