• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
kamenxrider

kamenxrider

readwise-mastra

Public
Like
readwise-mastra
Home
Code
8
app
1
jobs
1
lib
6
web
3
grounding.md
keyupdates.md
plan.md
tracker.md
Environment variables
6
Branches
1
Pull requests
Remixes
History
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
tracker.md
Code
/
tracker.md
Search
…
Viewing readonly version of main branch: v35
View latest version
tracker.md

Implementation Tracker

Current Status: Phase 1 - Not Started


Pollinations Integration Updates

Phase 1: Fix Core Endpoint & Configuration

Status: ⬜ Not Started

File: lib/env.ts

  • Update default POLLINATIONS_BASE_URL → https://gen.pollinations.ai
  • Add POLLINATIONS_CHAT_PATH (default: /v1/chat/completions)
  • Remove POLLINATIONS_MODEL env var (will be dynamic)
  • Add optional POLLINATIONS_PRIMARY_MODEL for override

Phase 2: SQLite Model Cache Schema

Status: ⬜ Not Started

File: lib/db.ts

  • Add model_cache table for discovered models
  • Add model_config table for selected primary/fallback models
  • Add upsertModelCache(model) function
  • Add getModelCache(type) function
  • Add getModelConfig(key) / setModelConfig(key, value) functions

Schema:

CREATE TABLE IF NOT EXISTS model_cache ( name TEXT PRIMARY KEY, type TEXT NOT NULL, -- 'text' or 'image' aliases TEXT, -- JSON array description TEXT, tools INTEGER DEFAULT 0, -- boolean reasoning INTEGER DEFAULT 0, -- boolean context_window INTEGER, pricing_json TEXT, input_modalities TEXT, -- JSON array output_modalities TEXT, -- JSON array last_updated TEXT NOT NULL ); CREATE TABLE IF NOT EXISTS model_config ( key TEXT PRIMARY KEY, value TEXT NOT NULL, updated_at TEXT NOT NULL );

Phase 3: Model Discovery Service

Status: ⬜ Not Started

File: lib/llm_pollinations.ts

  • Add discoverTextModels() - GET /v1/models + /text/models
  • Add discoverImageModels() - GET /image/models
  • Add refreshModelCache() - run discovery and cache to SQLite
  • Add selectBestModel(options) - pick model based on needs
  • Add getModelWithFallbacks() - return primary + fallback list

Model Priority:

  1. gemini (cheap, tools=true) - primary
  2. openai (baseline) - fallback 1
  3. gemini-large (complex tasks) - fallback 2

Phase 4: Smart Request Wrapper with Auto-Fallback

Status: ⬜ Not Started

File: lib/llm_pollinations.ts

  • Update generateChat() with model hints (useTools, complexTask)
  • Add auto-retry with fallback models on error
  • Add modelUsed and fallbacksAttempted to response
  • Update generateJSON() to use new wrapper
  • Update generateText() to use new wrapper

Phase 5: Image Generation

Status: ⬜ Not Started

File: lib/llm_pollinations.ts

  • Add generateImage(prompt, options) function
  • Download image and store in Val Town blob storage
  • Add getImageModels() function

File: app/http.ts

  • Add POST /api/image/generate endpoint
  • Add GET /api/image/models endpoint

Phase 6: Update Interval Job for Model Discovery

Status: ⬜ Not Started

File: jobs/sync/interval.ts

  • Add model cache refresh (daily)
  • Check last_discovery timestamp before refreshing

Phase 7: Update Agent for Smart Model Selection

Status: ⬜ Not Started

File: lib/agent.ts

  • Use complexTask: true for plan generation
  • Handle content_blocks in Gemini responses
  • Use cheaper model for simple triage suggestions

Phase 8: Add Model Management API Routes

Status: ⬜ Not Started

File: app/http.ts

  • Add GET /api/ai/models - list cached models + config
  • Add POST /api/ai/discover - trigger model rediscovery

Completed Phases

(none yet)


Notes

  • Image storage: Using Val Town blob storage (option B)
  • Model discovery: Once daily via interval job
  • No account balance tracking (provider-agnostic design)
  • Plan stored in grounding.md
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.