Inference

Create embedding (OpenAI-compatible)

OpenAI-compatible embeddings endpoint backed by EmbeddingGemma-300M on the Apple Neural Engine. Default model embeddinggemma (base, seqLen=512); embeddinggemma-tools (LoRA, seqLen=512) selectable via model. seqLen is read from the active R2 bundle's compiled input_ids shape, not hardcoded. Inputs exceeding it are rejected with context_length_exceeded. Supports Matryoshka truncation via dimensions (768/512/256/128) with automatic re-L2-normalization, and encoding_format: "base64" for little-endian float32 packing.

post/v1/embeddings

Request

  • Base URL: http://localhost:9998
  • URL: http://localhost:9998/v1/embeddings
  • Auth: HTTP bearer

Request body

modelstring

Must start with embeddinggemma.

task'retrieval.query' | 'retrieval.document' | 'classification' | 'clustering' | 'sts'
encoding_format'float' | 'base64'
dimensions768 | 512 | 256 | 128
userstring

Accepted and ignored, matches OpenAI client expectations.

Response

Embedding response

object'list' required
modelstring required

Changes

No recorded changes to this operation across all 1 revision of this API.