Skip to content

Exclude slackbot-only models from /openrouter/models by default#149

Draft
kiloconnect[bot] wants to merge 2 commits intomainfrom
session/agent_ccde0e9e-5c2c-4320-890e-e14b6b7f074e
Draft

Exclude slackbot-only models from /openrouter/models by default#149
kiloconnect[bot] wants to merge 2 commits intomainfrom
session/agent_ccde0e9e-5c2c-4320-890e-e14b6b7f074e

Conversation

@kiloconnect
Copy link
Contributor

@kiloconnect kiloconnect bot commented Feb 12, 2026

Summary

The /openrouter/models and /api/organizations/[id]/models endpoints now exclude slackbot-only models (e.g. anthropic/claude-opus-4.6:slackbot, minimax/minimax-m2.1:slackbot) by default. These models are only relevant for Kilo for Slack integrations and should not appear in the standard model selector.

Changes

Backend

  • src/lib/providers/openrouter/index.ts: enhancedModelList() and getEnhancedOpenRouterModels() now accept an { includeSlackbotOnly } option. When false (default), models with slackbot_only: true are filtered out.
  • src/app/api/openrouter/models/route.ts: Reads ?includeSlackbotOnly=true query parameter and passes it through.
  • src/app/api/organizations/[id]/models/route.ts: Reads ?includeSlackbotOnly=true query parameter and passes it through to the tRPC listAvailableModels procedure.
  • src/routers/organizations/organization-settings-router.ts: listAvailableModels accepts includeSlackbotOnly in its input and passes it to getEnhancedOpenRouterModels().
  • src/app/api/cron/sync-model-stats/route.ts: Explicitly passes { includeSlackbotOnly: true } to preserve complete model set for stats syncing.

Frontend

  • src/app/api/openrouter/hooks.ts: useModelSelectorList() accepts an optional second argument { includeSlackbotOnly }. When true, appends the query param to the fetch URL. The query key includes this flag so React Query caches them separately.

Usage

// Default: no slackbot-only models
useModelSelectorList(organizationId)

// Include slackbot-only models
useModelSelectorList(organizationId, { includeSlackbotOnly: true })
GET /api/openrouter/models                          # excludes slackbot-only
GET /api/openrouter/models?includeSlackbotOnly=true  # includes slackbot-only

GET /api/organizations/{id}/models                          # excludes slackbot-only
GET /api/organizations/{id}/models?includeSlackbotOnly=true  # includes slackbot-only

Built for Christiaan by Kilo for Slack

Add includeSlackbotOnly query parameter to opt in to including
slackbot-only models in the response. The useModelSelectorList hook
accepts an optional { includeSlackbotOnly } parameter that passes
the query param through to the API.
@kiloconnect
Copy link
Contributor Author

kiloconnect bot commented Feb 12, 2026

Code Review Summary

Status: 1 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 1
SUGGESTION 0
Issue Details (click to expand)

WARNING

File Line Issue
src/app/api/openrouter/hooks.ts 120 includeSlackbotOnly option is ignored when organizationId is set
Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
Files Reviewed (6 files)
  • src/app/api/cron/sync-model-stats/route.ts - 0 issues
  • src/app/api/openrouter/hooks.ts - 1 issue
  • src/app/api/openrouter/models/route.ts - 0 issues
  • src/app/api/organizations/[id]/models/route.ts - 0 issues
  • src/lib/providers/openrouter/index.ts - 0 issues
  • src/routers/organizations/organization-settings-router.ts - 0 issues

Fix these issues in Kilo Cloud

…dels in cron sync

- /api/organizations/[id]/models: filter out slackbot_only by default,
  with ?includeSlackbotOnly=true query param to opt back in
- /api/cron/sync-model-stats: explicitly include slackbot_only models
  since stats sync needs the complete model set
- /api/organizations/[id]/defaults: already uses default filtering
  (no slackbot_only), which is correct for default model selection
@kiloconnect
Copy link
Contributor Author

kiloconnect bot commented Feb 12, 2026

getEnhancedOpenRouterModels consumer audit

Consumer File Should filter slackbot_only? Action taken
/api/openrouter/models src/app/api/openrouter/models/route.ts ✅ Yes — user-facing model selector Already filtered (PR #149)
/api/organizations/[id]/models src/app/api/organizations/[id]/models/route.tsorganization-settings-router.ts ✅ Yes — org model selector, same use case Updated: filters by default, ?includeSlackbotOnly=true to opt in
/api/organizations/[id]/defaults src/app/api/organizations/[id]/defaults/route.ts ✅ Yes — picks a default model for the org No change needed: already uses default getEnhancedOpenRouterModels() which filters out slackbot_only
/api/cron/sync-model-stats src/app/api/cron/sync-model-stats/route.ts ❌ No — needs complete model set for stats sync Updated: explicitly passes { includeSlackbotOnly: true } to preserve current behavior

@chrarnoldus chrarnoldus marked this pull request as draft February 12, 2026 10:29
: '/api/openrouter/models';
const response = await fetch(
organizationId ? `/api/organizations/${organizationId}/models` : '/api/openrouter/models'
organizationId ? `/api/organizations/${organizationId}/models` : modelsUrl
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: includeSlackbotOnly option is ignored when organizationId is set

useModelSelectorList() adds includeSlackbotOnly to the query key and builds a URL for /api/openrouter/models, but when organizationId is present it fetches /api/organizations/:id/models without forwarding the query param. That makes includeSlackbotOnly a no-op for org-scoped requests (likely the common case).

Suggested change
organizationId ? `/api/organizations/${organizationId}/models` : modelsUrl
organizationId ? `/api/organizations/${organizationId}/models${includeSlackbotOnly ? '?includeSlackbotOnly=true' : ''}` : modelsUrl

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.

0 participants