Skip to content

feat: add OpenAI-compatible embedding provider - #158

Open
HosseinShahabadi wants to merge 1 commit into
qdrant:masterfrom
HosseinShahabadi:feat/openai-compatible-embedding-provider
Open

HosseinShahabadi wants to merge 1 commit into
qdrant:masterfrom
HosseinShahabadi:feat/openai-compatible-embedding-provider

Conversation

@HosseinShahabadi

@HosseinShahabadi HosseinShahabadi commented Jun 19, 2026 •

Copy link
Copy Markdown

Summary

Adds support for any OpenAI-compatible embeddings endpoint as an
alternative to fastembed. This allows users to use OpenAI, OpenRouter,
Azure OpenAI, Together AI, or any other compatible provider without
needing to run a local model.

Changes

  • embeddings/types.py — added OPENAI to EmbeddingProviderType enum
  • embeddings/openai.py — new provider implementing EmbeddingProvider
  • embeddings/factory.py — added openai branch to create_embedding_provider
  • settings.py — added OPENAI_API_KEY, OPENAI_BASE_URL, OPENAI_VECTOR_SIZE fields
  • README.md — documented new env vars and usage examples

New environment variables

Variable Description Default
OPENAI_API_KEY API key for the embedding service None
OPENAI_BASE_URL Base URL of the endpoint https://api.openai.com/v1
OPENAI_VECTOR_SIZE Vector dimensions (auto-detected if omitted) None

Example (OpenRouter)

EMBEDDING_PROVIDER="openai" \
OPENAI_API_KEY="sk-or-v1-..." \
OPENAI_BASE_URL="https://openrouter.ai/api/v1" \
EMBEDDING_MODEL="qwen/qwen3-embedding-4b" \
OPENAI_VECTOR_SIZE=2560 \
uvx mcp-server-qdrant

Testing

Tested locally with OpenRouter + qwen/qwen3-embedding-4b against
a local Qdrant instance. Both qdrant-store and qdrant-find tools
work correctly via MCP inspector.

Adds support for any OpenAI-compatible embeddings endpoint
(OpenAI, OpenRouter, Azure OpenAI, Together AI, etc.) as an
alternative to fastembed.

New env vars: EMBEDDING_PROVIDER=openai, OPENAI_API_KEY,
OPENAI_BASE_URL, OPENAI_VECTOR_SIZE.

Vector size is auto-detected at startup via a probe request
if OPENAI_VECTOR_SIZE is not set explicitly.
@castlenthesky

castlenthesky commented Sep 5, 2026 •

Copy link
Copy Markdown

@HosseinShahabadi, letting you know I've opened #187 as a draft for the same feature. Yours is the newest of three open OpenAI-compatible PRs (#92, #111, #158) and it felt wrong to add a fourth without saying anything.

#158 has gone stale against master and hasn't been reviewed. The pattern I see is that this repo is short on review bandwidth, and the one piece of guidance we've actually got from a maintainer (@kacperlukawski in #55, asking for "just OpenAI embeddings, but nothing else") hasn't been met by any of the three, since all of them ship refactors alongside the feature.

So mine is additive only: 26 lines touched in existing files, one new provider, FastEmbed left alone. If you'd rather push #158 across the line yourself, I'll close mine and help with the rebase. I just want the feature to exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants