Embeddings, rerank and moderation: the non-chat routes
Call embeddings, rerank and moderation on the same gateway key as chat, in the OpenAI shapes, with per-model prices and the catalog as the model list.
Three inference routes beyond chat run on the same key at https://api.uplinkswitch.com/v1: embeddings, rerank and moderation. The chat and models reference covers the chat surface; this page covers these three, each billed at its own model's per-token price, with the catalog as the list of which model answers which route.
Embeddings
POST /v1/embeddings takes the OpenAI shape: a model id and input, a string or an array of strings, and returns the OpenAI embedding list. Embedding ids that read availability: ok on the catalog at the time of writing include bge-base-en-v1.5, bge-m3, bge-small-en-v1.5 and gemini-embedding-001; confirm one on GET /v1/catalog before you wire it, its current input rate per million tokens is $0.1665 / $0.1665.
Rerank
POST /v1/rerank scores documents against a query. It takes model, query, a documents array, an optional top_n to trim the result, and return_documents to echo the text back with each score. Up to 1,000 documents are accepted, as strings or objects containing text. The query is counted beside each document for input billing. The rerank id bge-reranker-base reads ok at the time of writing; verify on the catalog.
Moderation
POST /v1/moderations takes the OpenAI shape, required input and an optional model (default text-moderation-latest), and returns the OpenAI moderation object. Note that no moderation-type model reads availability: ok on the catalog at the time this draft was written, so consult GET /v1/catalog before selecting a moderation model.
Example
curl https://api.uplinkswitch.com/v1/embeddings \
-H "Authorization: Bearer sk-uplink-live-..." \
-H "Content-Type: application/json" \
-d '{"model": "bge-base-en-v1.5", "input": "the quick brown fox"}'The reply is the embedding list in the OpenAI shape.
Status codes
A success is 200. Rerank accepts bodies up to 2 MB; embeddings and moderation use a 10 MB cap. A body that is not a JSON object, or is missing a required field, is 400 invalid_request, and a body over the size cap is 413. A missing or wrong key is 401 invalid_api_key; a key whose allowlist excludes the model is 403 scope_denied; a model string that matches nothing is 404 model_not_found. An empty balance is 402 insufficient_balance, and a rate ceiling is 429 rate_limited or upstream_rate_limited, both billing nothing. On the upstream side, the gateway returns 502 upstream_error when the last route it tries fails to answer, and 503 upstream_unavailable when no route is left; both carry a retry interval and charge nothing.