Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Principle:Ollama Ollama OpenAI Embeddings And Listing

From Leeroopedia
Knowledge Sources
Domains API_Design, NLP
Last Updated 2026-02-14 00:00 GMT

Overview

Translation mechanisms for OpenAI-compatible embedding generation and model listing endpoints that convert between Ollama and OpenAI response formats.

Description

This principle covers two auxiliary OpenAI-compatible endpoints:

Embeddings (/v1/embeddings): Translates OpenAI embedding requests to Ollama's embed API and formats the response as an OpenAI EmbeddingList. Supports both float and base64 encoding formats.

Model Listing (/v1/models): Translates Ollama's model list into the OpenAI models list format, mapping model names to OpenAI model objects with IDs and ownership information.

Usage

Use these translation patterns when implementing auxiliary API endpoints that provide embedding and model discovery capabilities in an OpenAI-compatible format.

Theoretical Basis

Embedding Translation:

  1. Receive OpenAI embedding request (model, input text, encoding_format)
  2. Translate to Ollama EmbedRequest
  3. Get embedding vectors from Ollama
  4. Format as OpenAI EmbeddingList with index, embedding, and usage

Model Listing Translation:

  1. Receive request at /v1/models
  2. Get model list from Ollama (/api/tags)
  3. Map each model to OpenAI Model object (id, object, owned_by)

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment