---
phase: 02-model-discovery
plan: 02-FIX
type: fix
---
Fix 1 UAT issue from plan 02-02.
Source: 02-02-ISSUES.md
Priority: 0 critical, 1 major, 0 minor
@~/.claude/get-shit-done/workflows/execute-phase.md
@~/.claude/get-shit-done/templates/summary.md
@.planning/STATE.md
@.planning/ROADMAP.md
**Issues being fixed:**
@.planning/phases/02-model-discovery/02-02-ISSUES.md
**Original plan for reference:**
@.planning/phases/02-model-discovery/02-02-PLAN.md
Task 1: Fix UAT-001 - Multiple category parameters causing 400 error
src/app/api/providers/fal/models/route.ts, src/lib/providers/fal.ts
Fix the fal.ai API route to handle multiple categories correctly.
**Root cause:** The `buildCategoryFilter()` function creates `category=text-to-image&category=image-to-image&...` but fal.ai API only accepts a single category parameter.
**Fix approach:** Fetch all models without category filter and filter client-side.
1. In route.ts:
- Remove `buildCategoryFilter()` function entirely
- Remove category params from URL construction (line 130)
- Keep only `status=active` in base URL
- Rely on existing `isRelevantModel()` filter (line 172) to filter results
2. In fal.ts (provider):
- Apply same fix to `listModels()` and `searchModels()` functions
- Remove any category URL params, filter results after fetch
**Why this approach:**
- Simpler than making 4 parallel API calls per category
- fal.ai returns manageable number of models
- Filtering is already implemented via `isRelevantModel()`
- No additional latency from multiple requests
curl -X GET "http://localhost:3000/api/providers/fal/models" returns JSON with success:true and models array
- API route returns 200 with models array
- Models are filtered to only image/video categories
- No 400 errors from fal.ai
Before declaring plan complete:
- [ ] `curl http://localhost:3000/api/providers/fal/models` returns success:true
- [ ] Response contains models with capabilities: text-to-image, image-to-image, text-to-video, image-to-video
- [ ] No models with other categories (audio, 3D, etc.) in response
- [ ] TypeScript compiles: `npx tsc --noEmit`
- [ ] Build succeeds: `npm run build`
- UAT-001 resolved - API route returns models without 400 error
- Models still filtered to relevant image/video categories
- No regression in other functionality