Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

docs: fix plan — add context_length to both catalog model pushes

Chris Staley305545623a85
diff --git a/docs/superpowers/plans/2026-04-02-gemini-model-metadata.md b/docs/superpowers/plans/2026-04-02-gemini-model-metadata.md
index 34dc05c31f..b595b50b97 100644
--- a/docs/superpowers/plans/2026-04-02-gemini-model-metadata.md
+++ b/docs/superpowers/plans/2026-04-02-gemini-model-metadata.md
@@ -216,13 +216,13 @@ git commit -m "feat(db): extend replaceCustomModels with metadata fields"
### Task 4: Use stored token limits in catalog
**Files:**
-- Modify: `src/app/api/v1/models/catalog.ts:443-458`
+- Modify: `src/app/api/v1/models/catalog.ts:443-480`
- [ ] **Step 1: Add context_length from stored inputTokenLimit for custom models**
-In the custom models section, add `context_length` to the first `models.push` (around line 443). After the existing `...(visionFields || {}),` line, add:
+There are two `models.push` calls for custom models — the main one and the provider-prefixed alias. Both need `context_length`.
-The full replacement for lines 443-458:
+Replace lines 443-458 (first push) with:
```typescript
models.push({
@@ -246,6 +246,26 @@ The full replacement for lines 443-458:
});
```
+Also add `context_length` to the second push (provider-prefixed alias, around line 469-480). Replace that push with:
+
+```typescript
+ models.push({
+ id: providerPrefixedId,
+ object: "model",
+ created: timestamp,
+ owned_by: canonicalProviderId,
+ permission: [],
+ root: modelId,
+ parent: aliasId,
+ custom: true,
+ ...(modelType ? { type: modelType } : {}),
+ ...(typeof (model as any).inputTokenLimit === "number"
+ ? { context_length: (model as any).inputTokenLimit }
+ : {}),
+ ...(providerVisionFields || {}),
+ });
+```
+
- [ ] **Step 2: Build to verify no type errors**
Run: `npx tsc --noEmit --pretty 2>&1 | head -30`