Safeguard Docs
API Platform (Console)

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.

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

Early access, off by default

Embeddings are switched on per workspace by Safeguard, in addition to the API Platform itself. Where they are off, the endpoint answers 403 gateway_disabled.

The request and response follow OpenAI's Embeddings format, so the OpenAI SDKs work with only the base URL changed.

Request

FieldTypeRules
modelstring, requiredAn embeddings model id from GET /models, such as openai/text-embedding-3-small. A chat model is refused with 400 invalid_request.
inputstring or array of strings, required1 to 256 non-empty strings. Token arrays are refused with 400 unsupported_parameter.
encoding_formatfloat or base64Passed to the provider.
dimensionspositive integerPassed to the provider, for models that can shorten their vectors.
userstringAccepted and dropped. It is never sent to the provider.

models and the provider routing fields are refused with 400 unsupported_parameter: an embeddings request uses exactly the model you name, because vectors from different models cannot be compared. There are no fallbacks for embeddings.

Anthropic offers no embeddings models through its API, so no anthropic/ model appears here.

Response

{
  "object": "list",
  "data": [{ "object": "embedding", "index": 0, "embedding": [0.0123, -0.0456] }],
  "model": "openai/text-embedding-3-small",
  "usage": { "prompt_tokens": 8, "total_tokens": 8, "cost": 0.00000016 }
}
  • usage.cost is in USD: the input tokens times the model's input price per 1M tokens, the provider's list price with no markup. Embeddings have no output tokens.
  • If the provider reports no token count, the gateway bills an estimate and adds usage.estimated: true.
  • The X-Generation-Id header is the id to quote to support, as for chat.

Billing and privacy

An embeddings request reserves its estimated cost from your credit before the call and settles the actual cost after it, like a chat request. Spend limits and per-key rate limits apply in the same way.

The request log holds metadata only (model, tokens, cost, latency, status). The text you send for embeddings is never stored, even when the workspace stores prompts for chat.

Example

curl https://api.safeguard.sh/gpt/v1/embeddings \
  -H "Authorization: Bearer $SAFEGUARD_INFERENCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "openai/text-embedding-3-small", "input": ["software bill of materials", "SBOM"]}'

On this page