Skip to main content
API Reference: POST /embeddings

Provider capabilities

The table below summarizes gateway support for this endpoint by provider.
Legend:
  • Supported by Provider and Truefoundry
  • Provided by provider, but not by Truefoundry
  • Provider does not support this feature
For every gateway endpoint and provider, see Supported APIs. An embedding is a sequence of numbers (a vector) that represents the semantic meaning of content such as natural language, code, or other structured data. They are widely used in Clustering, Semantic search and retrieval, Recommendation engines, Retrieval-Augmented Generation (RAG)

Basic Usage

Generate embeddings using the OpenAI-compatible API:
Expected Output:

Provider-Specific Features

Input Type - Cohere

When using Cohere models via the embeddings API, you must include an additional field called input_type in the request. This field indicates the purpose of the embedding and must be one of the following:
  • search_query
  • search_document
  • classification
  • clustering
Example:
Expected Output:

Task Types - Vertex AI & Gemini

Vertex AI and Gemini embedding models support task_type that optimizes embeddings for specific use cases. Specify the task type using the extra_body parameter. Available task types: RETRIEVAL_DOCUMENT, RETRIEVAL_QUERY, QUESTION_ANSWERING, FACT_VERIFICATION, SEMANTIC_SIMILARITY, CLASSIFICATION, CLUSTERING, CODE_RETRIEVAL_QUERY For detailed information about task types and when to use them, see: Example:
Expected Output:

Multimodal Embeddings - Vertex AI

Note: Multimodal embeddings are only available for the Vertex AI multimodalembedding@001 model.
Vertex AI supports multimodal embeddings that can encode images and videos along with text. This enables applications to search across multiple modalities or find semantic similarity between text and visual content.

Image Embeddings

Generate embeddings from images with optional text captions:
Expected Output:

Video Embeddings

Generate embeddings from video segments with temporal control:
Expected Output: