Last Updated: 2026-02-02
Status: ✅ Complete
File: lib/env.ts
POLLINATIONS_BASE_URL → https://gen.pollinations.aiPOLLINATIONS_CHAT_PATH (default: /v1/chat/completions)POLLINATIONS_MODEL env var (now dynamic)POLLINATIONS_PRIMARY_MODEL for overrideStatus: ✅ Complete
File: lib/db.ts
model_cache table for discovered modelsmodel_config table for selected primary/fallback modelsupsertModelCache(model) functiongetModelCache(type) functiongetModelConfig(key) / setModelConfig(key, value) functionsgetModelByName(name) functionclearModelCache(type?) functiongetAllModelConfig() functionStatus: ✅ Complete
File: lib/llm_pollinations.ts
discoverTextModels() - GET /v1/models + /text/modelsdiscoverImageModels() - GET /image/modelsrefreshModelCache() - run discovery and cache to SQLiteselectBestModel(options) - pick model based on needsgetModelWithFallbacks() - return primary + fallback listisDiscoveryNeeded() - check if cache is stale (>24h)ensureModelCache() - run discovery if neededStatus: ✅ Complete
File: lib/llm_pollinations.ts
generateChat() with model hints (useTools, complexTask)modelUsed and fallbacksAttempted to responsegenerateJSON() to use new wrappergenerateText() to use new wrappercontent_blocks in Gemini responsesStatus: ✅ Complete
File: lib/llm_pollinations.ts
generateImage(prompt, options) functiongetImageModels() functionFile: app/http.ts
POST /api/image/generate endpointGET /api/image/models endpointStatus: ✅ Complete
File: jobs/sync/interval.ts
last_discovery timestamp before refreshingStatus: ✅ Complete
File: lib/agent.ts
complexTask: true for plan generationStatus: ✅ Complete
File: app/http.ts
GET /api/ai/models - list cached models + configPOST /api/ai/discover - trigger model rediscoveryGET /api/ai/models - List cached text/image models and current configPOST /api/ai/discover - Manually trigger model rediscoveryPOST /api/image/generate - Generate image from prompt (stored in blob)GET /api/image/models - List available image modelsmodel_cache - Stores discovered models with metadatamodel_config - Stores selected primary/fallback modelsgemini (cheap, tools=true)openai (baseline compatibility)gemini-large (complex tasks)# Required READWISE_TOKEN=your_readwise_token APP_ADMIN_SECRET=your_secret_for_api_auth POLLINATIONS_TOKEN=your_pollinations_sk_token # Optional (with defaults) POLLINATIONS_BASE_URL=https://gen.pollinations.ai POLLINATIONS_CHAT_PATH=/v1/chat/completions POLLINATIONS_PRIMARY_MODEL= # leave empty for auto-discovery # Optional (webhooks) READWISE_WEBHOOK_SECRET=