feat: expand /v1/rerank, /v1/images/generations, /v1/responses beyond OpenAI-only
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 157
- Forks
- 32
- Avg merge
- 1h 25m
- Merged PRs (30d)
- 145
Description
Summary
Today the gateway restricts /v1/rerank, /v1/images/generations, and /v1/responses to OpenAI providers only (per #168 + #211, parallel to existing /v1/responses §4.6 restriction). This is currently defensible as a fail-fast against operator misconfiguration — a non-OpenAI Model on these routes would otherwise dispatch to an upstream that 404s.
But the restriction is more conservative than the de-facto reference implementation in this category, which treats these endpoints as multi-provider unified surfaces. Concrete real-world offerings the gateway currently rules out:
/v1/rerank — 14+ providers in the reference
- Cohere — the canonical rerank API; most common non-OpenAI rerank request shape
- Jina AI — popular for embedding + rerank pipelines
- Voyage AI — rerank-2 model is a frequent ask
- Azure AI, Together AI, Bedrock, NVIDIA NIM, Hosted vLLM, DeepInfra, Fireworks AI, Watsonx, Infinity, HuggingFace
/v1/images/generations — multi-provider
- Stability AI — SDXL, Stable Diffusion 3
- Black Forest Labs — FLUX.1
- AWS Bedrock — Titan Image, Amazon Nova Canvas, SDXL via Bedrock
- Azure (drop-in), Vertex AI Imagen, Gemini, Recraft, Fal AI, DashScope
/v1/responses — multi-provider
- Azure — drop-in compatible (lowest-friction next step)
- xAI — Grok with Responses API shape
- GitHub Copilot, VolcEngine, Manus, Perplexity, Databricks (GPT-gated), OpenRouter, Hosted vLLM
Why this matters
Each provider has its own native wire format for these endpoints. The reference handles this by shipping per-provider transform modules that convert the OpenAI-shaped request into the provider's native shape, and the response back. The gateway today has the bridge pattern (aisix-provider-{openai,anthropic,gemini,deepseek}) that already does this for chat completions; extending the same shape to these endpoints is a natural fit.
Suggested phases (incremental, ordered by user pain × implementation cost)
Phase 1 — /v1/rerank Cohere
- Most common non-OpenAI rerank request; many RAG pipelines depend on Cohere reranker.
- Cohere's wire shape is well-documented and stable.
- Add transform in
aisix-provider-cohere(new crate or fold into an existing provider crate). - Relax
/v1/rerankrestriction docs to mention OpenAI + Cohere.
Phase 2 — /v1/images/generations Stability + BFL
- Both expose well-defined APIs distinct from OpenAI's
/v1/images/generations. - Stability's API shape requires a transform; BFL similar.
Phase 3 — /v1/responses Azure
- Drop-in compatible (Azure deployments are bit-for-bit compatible with OpenAI's wire shape modulo authentication).
- Lowest-cost expansion: just allowlist Azure provider on the route.
- Then xAI (Grok), which is API-similar but auth-different.
Each phase ships:
- Provider-specific request/response transforms
- Rust unit tests covering the transform shape
- E2E tests against the live mock for the provider
- Docs §4.x update relaxing the OpenAI-only restriction to the supported provider set
Out of scope
- Streaming for these endpoints — separate concern; some providers (e.g. Bedrock images) don't support it.
- Tool calling on /responses — already supported on OpenAI; cross-provider parity is part of #170's tool-translation work.
Companion
- #168 / #211 — established the current restrictive stance
- #212 — e2e coverage for the current restriction (will need rewriting per provider as the expansion lands)
Surfaced by
CLAUDE.md §6 research-discipline triage on the follow-up issues queue. Compared the gateway's endpoint coverage against the documented-and-tested provider matrix of the canonical multi-provider routing implementation in this space.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with CLAUDE.md §6, the current provider restrictions, and the existing aisix-provider bridge pattern. Scope the phases in order, beginning with Cohere, then review #212 for the restriction coverage that will need rewriting. Done means provider-specific transforms, Rust unit tests, provider mock E2E tests, and the relevant docs §4.x updates for each supported phase.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, azure, rust
- Domain
- api, backend-api-design, cloud
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100