feat(providers): add DeepInfra preset - #747
Conversation
📝 WalkthroughWalkthroughThe PR adds DeepInfra as an OpenAI-compatible provider with API-key authentication, bounded live model discovery, slash-preserving routing, metadata support, registry parity, tests, and documentation in five languages. ChangesDeepInfra provider integration
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant ProviderRegistry
participant DeepInfraModels
participant DeepInfraInference
Client->>ProviderRegistry: select deepinfra and provide API key
ProviderRegistry->>DeepInfraModels: discover models with Bearer authentication
DeepInfraModels-->>ProviderRegistry: return bounded chat-tagged models
ProviderRegistry-->>Client: expose native model IDs and metadata
Client->>DeepInfraInference: send chat completion with selected model ID
DeepInfraInference-->>Client: return chat completion response
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
NEEDS-CHANGES + NEEDS-SECURITY-REVIEW (draft) The code is in good shape. What is missing is the evidence, not the implementation. The reason that list exists is that a canonical preset is where someone's API key gets sent. If a destination changes hands or its terms shift, we need to know who noticed and when. Both of these services aggregate third-party models, so the routing authorization item applies. If the evidence turns out to be hard to pin down, an inert reference row in What happens next: keep it in draft, add the missing primary-source evidence and a maintenance owner, then request security review. CI context (shared across the current review round). |
lidge-jun
left a comment
There was a problem hiding this comment.
Formalizing the disposition so it shows on your dashboard.
Blocking on the MAINTAINERS.md:35 evidence gate rather than the code — the presets and fixture tests are well built.
Missing: terms of service and operating legal entity, a named maintenance owner, and a citable verification date. Both DeepInfra and Novita aggregate third-party models, so routing authorization applies as well. The endpoint documentation you supplied is fine.
Worth knowing before you invest more: deepinfra and novita both already have inert rows in src/providers/free-directory.ts. When the evidence is incomplete, the same clause prefers a directory row over a canonical registry entry — so the fallback here is "leave them where they already are", not "drop the work".
Full per-item walkthrough in my earlier comment.
635721f to
0e30431
Compare
|
Addressed the canonical-preset evidence gate and rebased onto current
@lidge-jun, could you please re-review and perform the required security review? In particular, please confirm whether the cited DeepInfra Terms satisfy the aggregator-routing evidence gate; the PR body identifies that point explicitly for maintainer/security confirmation. @coderabbitai review |
0e30431 to
33c6cfe
Compare
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
REPO="lidge-jun/opencodex"
PR=747
echo "=== PR info ==="
gh pr view $PR --repo $REPO --json title,state,isDraft,baseRefName,headRefName,mergeable,additions,deletions,changedFiles
echo "=== Files changed ==="
gh pr diff $PR --repo $REPO --name-only
echo "=== registry.ts DeepInfra section ==="
gh pr diff $PR --repo $REPO -- src/providers/registry.ts | sed -n '1,400p'Length of output: 1770 🏁 Script executed: #!/bin/bash
set -euo pipefail
REPO="lidge-jun/opencodex"
PR=747
gh pr diff $PR --repo $REPO > /tmp/pr747.diff
wc -l /tmp/pr747.diff
echo "=== registry.ts diff ==="
awk '/^diff --git a\/src\/providers\/registry.ts/{flag=1} /^diff --git a\/(?!src\/providers\/registry.ts)/{if(flag && $0!~/registry.ts/) flag=0} flag' /tmp/pr747.diff | head -300
echo "=== extract via csplit-like approach ==="
python3 - <<'EOF'
import re
with open('/tmp/pr747.diff') as f:
content = f.read()
files = re.split(r'(?=^diff --git )', content, flags=re.M)
for f in files:
header = f.splitlines()[0] if f.splitlines() else ''
if 'registry.ts' in header or 'provider-fetch.ts' in header:
print(f)
print("=====END FILE=====")
EOFLength of output: 15386 🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== filter type defs ==="
rg -n "containsAny|allOf" src/providers/registry.ts src/codex/catalog -g '*.ts' -C2 | head -100
echo "=== docs providers.md diff (English) ==="
python3 - <<'EOF'
import re
with open('/tmp/pr747.diff') as f:
content = f.read()
files = re.split(r'(?=^diff --git )', content, flags=re.M)
for f in files:
header = f.splitlines()[0] if f.splitlines() else ''
if 'docs-site/src/content/docs/guides/providers.md' in header:
print(f)
EOFLength of output: 4148
Registry entry — Context-window parsing — Fixture and tests. Registry parity — Docs. Scope check. On the open item I'll kick off a full review pass now. ✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs-site/src/content/docs/guides/providers.md`:
- Line 210: Update the DeepInfra entries in
docs-site/src/content/docs/guides/providers.md:210-210,
docs-site/src/content/docs/ja/guides/providers.md:136-136,
docs-site/src/content/docs/ko/guides/providers.md:136-136,
docs-site/src/content/docs/ru/guides/providers.md:146-146, and
docs-site/src/content/docs/zh-cn/guides/providers.md:128-128 to state that
DeepInfra is a key-based OpenAI Chat Completions provider using openai-chat and
a Bearer API key, translating the description for each locale. Do not imply
OAuth, passthrough, or a custom wire protocol.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 29898596-2816-4a88-abbf-f9d82071edc5
📒 Files selected for processing (15)
docs-site/src/content/docs/getting-started/quickstart.mddocs-site/src/content/docs/guides/providers.mddocs-site/src/content/docs/ja/getting-started/quickstart.mddocs-site/src/content/docs/ja/guides/providers.mddocs-site/src/content/docs/ko/getting-started/quickstart.mddocs-site/src/content/docs/ko/guides/providers.mddocs-site/src/content/docs/ru/getting-started/quickstart.mddocs-site/src/content/docs/ru/guides/providers.mddocs-site/src/content/docs/zh-cn/getting-started/quickstart.mddocs-site/src/content/docs/zh-cn/guides/providers.mdsrc/codex/catalog/provider-fetch.tssrc/providers/registry.tstests/deepinfra-provider.test.tstests/fixtures/deepinfra-models.jsontests/provider-registry-parity.test.ts
33c6cfe to
15a4336
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/deepinfra-provider.test.ts`:
- Around line 149-153: Update the assertions in the chat-model discovery test to
verify the second model’s parsed context window as well: assert contextWindow is
65_536 for the Qwen/Qwen2.5-VL-72B-Instruct entry, while preserving the existing
DeepSeek assertion and discovery checks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: f6460bfa-b201-480c-9a3b-f6155d71a499
📒 Files selected for processing (15)
docs-site/src/content/docs/getting-started/quickstart.mddocs-site/src/content/docs/guides/providers.mddocs-site/src/content/docs/ja/getting-started/quickstart.mddocs-site/src/content/docs/ja/guides/providers.mddocs-site/src/content/docs/ko/getting-started/quickstart.mddocs-site/src/content/docs/ko/guides/providers.mddocs-site/src/content/docs/ru/getting-started/quickstart.mddocs-site/src/content/docs/ru/guides/providers.mddocs-site/src/content/docs/zh-cn/getting-started/quickstart.mddocs-site/src/content/docs/zh-cn/guides/providers.mdsrc/codex/catalog/provider-fetch.tssrc/providers/registry.tstests/deepinfra-provider.test.tstests/fixtures/deepinfra-models.jsontests/provider-registry-parity.test.ts
15a4336 to
75ac18d
Compare
|
Final follow-up after automated review and CI:
The remaining gate is the maintainer/security determination requested above for the cited third-party-model routing evidence, followed by re-review/dismissal of the earlier evidence-based changes request. |
Ingwannu
left a comment
There was a problem hiding this comment.
Security review completed against 75ac18da8b1bd598691b48f08466913d28ba0806.
No blocking security finding was identified.
- The canonical inference destination is fixed to
https://api.deepinfra.com/v1/openai, and authenticated discovery is registry-owned athttps://api.deepinfra.com/v1/models. preserveCustomDestinationprevents a pre-existing same-name custom provider and its API key from being silently retargeted.- Redirects are rejected/manual at the existing validation and discovery boundaries, and catalog input is bounded to 512 KiB / 512 rows before filtering.
- Model IDs remain data, not URL destinations; slash-containing IDs do not alter the fixed provider host.
- The updated PR evidence identifies DEEP INFRA, INC., documents both endpoints and Bearer authentication, names a maintenance owner, gives a verification date, and explains the direct user-key routing basis.
This approval is the explicit credential-destination security review required by MAINTAINERS.md. It does not dismiss or override another maintainer's earlier change request.
[shipping-github] Dismissing as obsolete: the 2026-07-30 evidence gate is addressed on tip 6d97a9f. PR body now cites DEEP INFRA, INC. ToS (2024-07-04), fixed openai + /v1/models endpoints, aggregator routing basis, maintenance owner @olddonkey, and verification date 2026-07-30. @Ingwannu already APPROVED security on 75ac18d; live GET /v1/models returns metadata.tags (chat filter works without with_meta). CodeRabbit threads resolved. Tip restacked onto current dev.
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/providers/registry.ts (1)
823-825: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winPrevent registry defaults from applying to custom DeepSeek destinations.
src/providers/registry.ts:812-826does not setpreserveCustomDestination: true, sodeepseek-v4-flashreceivesopenai-responsesfor custombaseUrlvalues. Add the flag and cover canonical, explicitmodelAdapters, and custom-baseUrlcases intests/adapter-resolve.test.ts:103-129.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/providers/registry.ts` around lines 823 - 825, Update the DeepSeek V4-Flash registry entry near modelWireDefaults to set preserveCustomDestination: true, preventing the default adapter from applying when a custom baseUrl is used. Extend the relevant adapter resolution tests in adapter-resolve.test.ts to cover canonical resolution, explicit modelAdapters, and custom-baseUrl behavior for deepseek-v4-flash.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs-site/src/content/docs/ko/guides/providers.md`:
- Around line 119-120: Synchronize the OAuth section with the documented
seven-provider count by adding the `github-copilot` login command and its
corresponding provider row, matching the English documentation and existing
formatting. Update the OAuth count from six to seven only as part of this
complete list change, or consistently document GitHub Copilot as excluded if
that is the intended behavior.
---
Outside diff comments:
In `@src/providers/registry.ts`:
- Around line 823-825: Update the DeepSeek V4-Flash registry entry near
modelWireDefaults to set preserveCustomDestination: true, preventing the default
adapter from applying when a custom baseUrl is used. Extend the relevant adapter
resolution tests in adapter-resolve.test.ts to cover canonical resolution,
explicit modelAdapters, and custom-baseUrl behavior for deepseek-v4-flash.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 3700b149-4996-4202-8050-2196bba50dda
📒 Files selected for processing (15)
docs-site/src/content/docs/getting-started/quickstart.mddocs-site/src/content/docs/guides/providers.mddocs-site/src/content/docs/ja/getting-started/quickstart.mddocs-site/src/content/docs/ja/guides/providers.mddocs-site/src/content/docs/ko/getting-started/quickstart.mddocs-site/src/content/docs/ko/guides/providers.mddocs-site/src/content/docs/ru/getting-started/quickstart.mddocs-site/src/content/docs/ru/guides/providers.mddocs-site/src/content/docs/zh-cn/getting-started/quickstart.mddocs-site/src/content/docs/zh-cn/guides/providers.mdsrc/codex/catalog/provider-fetch.tssrc/providers/registry.tstests/deepinfra-provider.test.tstests/fixtures/deepinfra-models.jsontests/provider-registry-parity.test.ts
Windows CI timed out the intentional 5.1s stall under a 7s budget; align ko/ja/zh-cn OAuth sections with the English six-plus-Copilot wording.
[shipping-github] Security reviewPR / issue: Findingsnone confirmed SummaryReviewed the DeepInfra canonical preset on tip Residual
Fixes this session
|
[shipping-github] Verdict: approve-commentPR: UsefulnessYes — promotes a collision-safe DeepInfra API-key preset with live chat-only discovery into CLI init, key login, and dashboard surfaces; Novita correctly left out of this PR. Bugs / correctness
Security
Spec / standards
Reviews
Base / CI
Gatenone Bottom lineShip-ready DeepInfra preset: useful, evidence gate satisfied, security Pass, CI green on tip. Merge when you want (not merging unless asked). |
[shipping-github] Merge readyPR: Reviews
Tip freshness
Checks
ResidualAggregator routing authorization remains a documented maintainer judgment on cited DeepInfra ToS language — not a code blocker. Ready to merge. |
|
Thanks @olddonkey — merging this. Why it helps: users can pick DeepInfra as a first-class API-key provider in init, key login, and the dashboard, with live chat-only model discovery from the documented Ship it. |
Summary
deepinfraAPI-key preset, derived automatically into CLI init, key login, and dashboard provider surfacesGET https://api.deepinfra.com/v1/modelsendpoint and keep only rows whosemetadata.tagscontainchatmetadata.context_lengthNovita is intentionally no longer part of this canonical-preset PR. Its existing inert row in
src/providers/free-directory.tsremains available; it can be promoted separately if primary sources establish the operating legal entity and routing authorization required byMAINTAINERS.md.Safety and scope
https://api.deepinfra.com/v1/openai, and the authenticated discovery destination is fixed tohttps://api.deepinfra.com/v1/modelsconfig.jsonor the key-login projectionpreserveCustomDestinationkeeps an older same-named custom provider on its original host and adapter, including model discoverydevand relates to the provider-expansion umbrella in [Provider] Promote a verified batch of OpenAI-compatible inference providers #572Canonical-preset evidence
Verified on 2026-07-30:
/v1/openai, including chat completions.GET https://api.deepinfra.com/v1/modelswithAuthorization: Bearer <token>and a response containingmetadata.tagsandmetadata.context_length.Verification
bun run typecheckbun run privacy:scanbun test tests/deepinfra-provider.test.ts tests/provider-registry-parity.test.ts tests/provider-model-discovery-contract.test.ts tests/codex-catalog.test.ts— 169 pass, 0 failbun run test— 6273 pass, 4 skip, 0 fail across 457 filesbun run buildindocs-site/— 146 pages builtRelates to #572. This PR does not close the umbrella issue.
Summary by CodeRabbit