Skip to main content
Embeddings turns text into vectors: lists of numbers that capture meaning, so that passages about the same idea end up close together even when they share no words. Store them in a vector database and you can build semantic search, retrieval-augmented generation (RAG), clustering, deduplication and recommendations on top. If the idea is new to you, Embeddings: How AI Understands Meaning explains it from the ground up. POST /ai/v2/direct/embeddings serves every embedding model in the Gloo catalog (OpenAI, Google, Voyage AI, Mistral, Qwen, BAAI and more) behind one request shape. The request and response mirror the OpenAI Embeddings API, so the OpenAI SDKs work by pointing the base URL at Gloo.
You don’t need this endpoint to search content you have uploaded to Gloo. The Data Engine embeds your content for you, and Search and the grounded endpoints query it. Use Embeddings when you run your own vector store.

Quick start

URL: https://platform.ai.gloo.com/ai/v2/direct/embeddings Operation: POST
Authentication is the same as the rest of the platform: send your API key as a Bearer token. See Generate API Keys.

With the OpenAI SDK

Request format

Any other parameter you send is passed to the model provider unchanged, so provider-specific options work without waiting for Gloo to add them. Input rules:
  • Each string must fit within the model’s input limit (max_input_tokens in the catalog, which is as low as 512 tokens for some models). A longer string is rejected with a 400, so split long documents into chunks first; Building a Knowledge Base covers how.
  • Arrays of token IDs, which the OpenAI API also accepts, are not supported. Send text.
  • Empty or whitespace-only strings are rejected.

Response format

  • data holds one embedding per input string, in the same order as input. index is the string’s position.
  • embedding is the provider’s vector passed through untouched, in the encoding you asked for: an array of floats by default, or a base64 string of little-endian float32 bytes with encoding_format: "base64". Gloo never rounds or converts it.
  • model is the value you sent.
  • usage is the number of tokens you are billed for.

Choosing a model

Every model whose output_modalities includes embeddings works here, and sending a chat model returns a 400 that says so. Supported Models lists embedding models alongside chat models, with each model’s input price and its input limit in the Context column. To list only the embedding models, filter the public catalog:
Two things to settle before you embed a large corpus:
  • Stay on one model. Vectors from different models, or from the same model with different dimensions, are not comparable. Embed your documents and your queries with the same model and settings, and re-embed everything if you switch.
  • Vector size differs by model. For example, gloo-openai-text-embedding-3-small returns 1536 numbers and gloo-baai-bge-base-en-v1.5 returns 768. Size your vector store’s column to the model you pick.

What runs, and what doesn’t

This is a direct endpoint. Authentication, organization entitlement, usage metering and platform rate limits apply as everywhere else. Guardrails, moderation, routing and streaming do not: your text goes to the model you name and nothing screens it first. Unlike the direct chat endpoints, embeddings requests are not failed over to a second provider. If the provider is down or rate-limiting, you get a 503 with retryable: true; retry with exponential backoff.

Pricing

Embeddings are billed per input token at the model’s published input rate. There is no output charge and no platform fee. Live rates are on Supported Models and GET /platform/v2/models; your spend shows up in API usage.

Errors

The full list of error codes is in Error Reference.