Safeguard Docs
API Platform (Console)

Completions

POST /completions reference: the legacy text-completions format, for tools that still send a single prompt string.

POST https://api.safeguard.sh/gpt/v1/completions

Getting access

The completions endpoint needs access on your workspace, in addition to the API Platform itself. Where it is not available, it answers 403 gateway_disabled. New code should use chat completions.

Some older tools only speak OpenAI's legacy Completions format. The gateway accepts it for chat models: your prompt becomes one user message, and the request then runs exactly like a chat completion (the same models, routing, billing, limits and request log).

Request

FieldTypeRules
modelstring, requiredA chat model id from GET /models. An embeddings model is refused with 400 invalid_request.
promptstring, requiredOne string. An array of prompts or a token array is refused with 400 unsupported_parameter.
max_tokensintegerAs for chat.
temperature, top_p, stopAs for chat.
stream, stream_optionsAs for chat. See Streaming.
seed, presence_penalty, frequency_penaltyPassed to the provider.
models, providerRouting and the routing options, as for chat.
userstringAccepted and dropped.

Refused with 400 unsupported_parameter: suffix, echo, logprobs, best_of, and n other than 1.

Response

{
  "id": "gen-…",
  "object": "text_completion",
  "created": 1760457600,
  "model": "openai/gpt-6-sol",
  "provider": "openai",
  "choices": [{ "text": "An SBOM lists every component in a piece of software.", "index": 0, "finish_reason": "stop", "logprobs": null }],
  "usage": { "prompt_tokens": 12, "completion_tokens": 13, "total_tokens": 25, "cost": 0.000154 }
}

Streamed chunks have the same object and carry the new text in choices[0].text, then data: [DONE].

Example

curl https://api.safeguard.sh/gpt/v1/completions \
  -H "Authorization: Bearer $SAFEGUARD_INFERENCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "openai/gpt-6-sol", "prompt": "Define SBOM in one sentence.", "max_tokens": 60}'

On this page