api7 / api7/aisix

legacy empty-provider openai-adapter keys stay route-dependent on unset api_base after #1017

Open
#1,019 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
157
Forks
32
Avg merge
1h 25m
Merged PRs (30d)
145

Description

Residue acknowledged during the #1018 audit.

resolve_base_url's openai default-base fallback (#1017 / #1018) is keyed strictly on provider == "openai". The openai family bridge is looser: it refuses only a non-empty non-openai vendor and still falls back for the legacy empty-provider shape (family_bridge_allows_legacy_empty_provider_with_empty_api_base).

So a legacy row {provider: "", adapter: "openai"} with no api_base remains route-dependent — chat falls back to the default base via the bridge, while the direct-HTTP routes (audio, image edits, jobs, realtime, responses, count_tokens/messages) 400 — the same symptom class #1017 fixed for well-formed rows.

The resolver's strictness is deliberate: it also serves non-OpenAI-family paths (an empty-vendor anthropic-adapter row must never fall back to api.openai.com), so the empty shape cannot be widened there without an adapter-aware check. Options, in rough preference order:

  1. Close the legacy shape at the source: have the loaders / cp-api reject or migrate empty-provider rows (provider is written on every row by cp-api today; only hand-written declarative files can produce the shape).
  2. Adapter-aware fallback: allow the empty-vendor fallback only when adapter == openai, mirroring the bridge's exact predicate — needs a sweep of the anthropic-family callers to prove no path can reach it with a non-OpenAI credential.
  3. Tighten the bridge instead: make the family bridge refuse the empty shape too, converging on strict — a behavior change for any legacy rows still relying on it, so it needs the compat treatment.

Either way, the two predicates (bridge vs resolver) should end up documented against each other; today the divergence is only stated in resolve_base_url's doc comment.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the resolve_base_url fallback and family_bridge_allows_legacy_empty_provider_with_empty_api_base predicate, then trace the loaders/cp-api and the listed direct-HTTP routes. Decide which compatibility option is intended, verify the bridge and resolver predicates no longer diverge unexpectedly, and document their relationship.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api, backend-api-design
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.