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/completionsEarly access, off by default
The completions endpoint is switched on per workspace by Safeguard, in addition to the API Platform itself. Where it is off, 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
| Field | Type | Rules |
|---|---|---|
model | string, required | A chat model id from GET /models. An embeddings model is refused with 400 invalid_request. |
prompt | string, required | One string. An array of prompts or a token array is refused with 400 unsupported_parameter. |
max_tokens | integer | As for chat. |
temperature, top_p, stop | As for chat. | |
stream, stream_options | As for chat. See Streaming. | |
seed, presence_penalty, frequency_penalty | Passed to the provider. | |
models, provider | Routing and the routing options, as for chat. | |
user | string | Accepted 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}'Chat completions
POST /chat/completions reference: every request field the gateway reads or passes on, the response fields, cost, and the v1 limits.
Embeddings
POST /embeddings reference: turn text into vectors with an embeddings model, billed per input token at the provider's list price with no markup.