Skip to content

feat: add /v1/embeddings gateway endpoint - #3

Merged
m3hrdadfi merged 1 commit into
mainfrom
feature/embeddings-endpoint
Aug 28, 2026
Merged

feat: add /v1/embeddings gateway endpoint#3
m3hrdadfi merged 1 commit into
mainfrom
feature/embeddings-endpoint

Conversation

@m3hrdadfi

Copy link
Copy Markdown
Owner

Summary

  • Adds an OpenAI-compatible /v1/embeddings (and /{provider_id}/v1/embeddings) route to the gateway, reusing the existing provider registry, rate limiting, capacity control, per-target fallback, and request/attempt logging used by /v1/chat/completions.
  • OpenAICompatibleAdapter gains prepare_embeddings_request, building requests against {base_url}/embeddings. AnthropicAdapter has no embeddings API, so it inherits the base adapter's AdapterError rejection.
  • Adds estimate_embedding_tokens for token-bucket capacity reservation based on the input field.
  • /v1/embeddings (and its provider-scoped variant) now require the same Bearer-token machine auth as the other /v1/* routes.

Test plan

  • python3 -m pytest tests/ -q — 39 passed (4 new: embeddings request prep for OpenAI-compatible and Anthropic adapters, missing-input rejection, token estimator)
  • Manual smoke test against a real OpenAI-compatible embeddings endpoint (not run in this session)

🤖 Generated with Claude Code

Adds an OpenAI-compatible embeddings proxy alongside the existing
chat-completions gateway, reusing the same provider registry, rate
limiting, capacity control, fallback, and request logging. Anthropic's
adapter has no embeddings API, so it raises AdapterError there.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@m3hrdadfi
m3hrdadfi merged commit fd3f84d into main Aug 28, 2026
2 checks passed
@m3hrdadfi
m3hrdadfi deleted the feature/embeddings-endpoint branch August 28, 2026 08:42
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.

1 participant