Skip to main content
SGL Grid exposes embeddings at POST /v1/embeddings. Existing text models accept OpenAI-compatible string and string-array input. EmbeddingGemma 2 adds ordered text, image, audio, video, and mixed items while preserving the same response shape.
Release candidate: EmbeddingGemma 2 has passed real Apple Silicon runtime tests, but production discovery and traffic remain default off until the release migration, packaged desktop lifecycle, and live billing/failover canaries pass. Do not assume it is available unless GET /v1/models?type=embedding returns embeddinggemma-2.

Grid and Local modes

The Local candidate requires Apple Silicon and macOS 15 or later. During the release-candidate period it is visible only in builds made with VITE_EMBEDDINGGEMMA2_ENABLED=true, and its native runtime also requires SGL_EMBEDDINGGEMMA2_ENABLED=true. These developer flags do not enable production Grid traffic.

Endpoint

Use a Compute/Grid API key with grid:write scope for prepaid credits:
Without an API key, the first request returns 402 Payment Required. Read accepts[], create the x402 payment, and retry with X-Payment. The server verifies payment before inference and settles only after it validates the returned vectors and usage.

Request fields

Legacy string and string-array input remains valid:
For multimodal input, every top-level item has an ordered content array:
The server does not fetch media URLs. Hash the decoded file bytes, then send those same bytes as canonical base64. duration_seconds is required for audio and video; the runtime verifies the decoded duration and rejects an understated declaration. Omitting input_type is exactly equivalent to "input_type":"query" for EmbeddingGemma 2. The Grid seals that explicit value with the ordered input, so admission, quoting, and runtime prefixing agree. unspecified is an explicit opt-out and is never the default.

Limits

Preflight uses conservative bounds before any claim or payment. The runtime then verifies media magic, dimensions or duration, decoded work, actual processor usage, output dimensions, finite values, ordering, and unit normalization.

Response

data is sorted by index and contains one vector per top-level input item. Embeddings are L2-normalized, so dot product is equivalent to cosine similarity. Usage is input only; there are no output tokens. The example shortens the embedding array for display; the real array contains exactly the requested number of floats. When x402 capture succeeds but its durable accounting finalizer still needs recovery, a successful response also contains "billing_pending":true and a job_id. Do not resubmit that paid request. The idempotent billing outbox completes accounting by job id.

Privacy and retention

The Grid seals the full ordered input and effective input_type to the selected node with negotiated v2/base64 X25519 transport. There is no plaintext media fallback. The job row temporarily persists that encrypted input envelope, and the node result is also stored as an encrypted envelope. After a job becomes terminal, input_payload becomes eligible for deletion at 30 minutes and encrypted_result at one hour. The purge runs hourly, so the practical upper bounds are about 90 minutes for input and two hours for results. Plaintext node errors can contain prompts, media, paths, and tracebacks. Node-supplied failure text is therefore classified transiently and persisted only as embedding_input_invalid, embedding_context_overflow, or embedding_runtime_failed. Orchestrator-owned validation paths can store bounded service reasons, but GET /v1/jobs/{id} normalizes every EG2 runtime failure to the same stable public codes.

Errors

Errors use {"error":{"message":"...","type":"...","code":"..."}}. The code field is present only where shown. The request endpoint returns client-safe messages. GET /v1/jobs/{id} can expose only the stable stored failure reason: embedding_input_invalid, embedding_context_overflow, or embedding_runtime_failed. Plaintext node reason text is never persisted.

Discover availability

The model appears only when release flags are on and at least one active node reports the exact ready protocol, runtime, processor revision, requested dimensions and modalities, sealed-input encoding, and model id. A remote catalog row alone cannot make it discoverable.

Existing text models

The original text-only catalog remains available through the same endpoint: These models accept string/string-array input only. Structured content is rejected instead of being flattened or routed through chat. See the complete Embeddings API reference and Provide Compute to run a node.