Skip to content

feat(ai-gateway): filter stale direct BYOK models - #4862

Merged
chrarnoldus merged 4 commits into
mainfrom
filter-stale-direct-byok-models
Jul 29, 2026
Merged

feat(ai-gateway): filter stale direct BYOK models#4862
chrarnoldus merged 4 commits into
mainfrom
filter-stale-direct-byok-models

Conversation

@chrarnoldus

Copy link
Copy Markdown
Contributor

Stack

Summary

  • filter models.dev entries against hardcoded unauthenticated model lists for Ollama Cloud and OpenCode Go
  • keep models.dev as the source of model metadata and use provider responses only as an ID allow-list
  • leave Alibaba Token Plan, Z.ai Coding Plan, and Xiaomi Token Plan on models.dev-only discovery because their /models endpoints require authentication
  • avoid runtime endpoint discovery or suitability heuristics

Endpoint verification

  • https://ollama.com/v1/models: unauthenticated, complete models.dev ID coverage
  • https://opencode.ai/zen/go/v1/models: unauthenticated, complete models.dev ID coverage plus one provider-only ID
  • Alibaba, Z.ai, Xiaomi AMS, and Xiaomi SGP /models: returned 401

Tests

  • pnpm --filter web test -- --runInBand src/lib/ai-gateway/providers/direct-byok/sync-direct-byok.test.ts
  • pnpm --filter web typecheck
  • targeted oxlint and oxfmt --list-different checks

@chrarnoldus chrarnoldus self-assigned this Jul 29, 2026
@kilo-code-bot

kilo-code-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

The optional provider allow-list filter added to parseModelsDevProviderModels and modelsDevFetcher is correctly scoped to Ollama Cloud and OpenCode Go, backward compatible for other providers, and covered by a new unit test.

Files Reviewed (2 files)
  • apps/web/src/lib/ai-gateway/providers/direct-byok/sync-direct-byok.ts
  • apps/web/src/lib/ai-gateway/providers/direct-byok/sync-direct-byok.test.ts

Reviewed by claude-sonnet-5 · Input: 16 · Output: 2.4K · Cached: 287.4K

Review guidance: REVIEW.md from base branch swanky-observation

Base automatically changed from swanky-observation to main July 29, 2026 14:54
@chrarnoldus
chrarnoldus merged commit 02a58f1 into main Jul 29, 2026
15 checks passed
@chrarnoldus
chrarnoldus deleted the filter-stale-direct-byok-models branch July 29, 2026 15:59
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