7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.
TypeScript
import type { Db } from '../types.js';
function hasColumn(db: Db, table: string, column: string): boolean {
const columns = db.prepare(`PRAGMA table_info(${table})`).all() as { name: string }[];
return columns.some(col => col.name === column);
}
function addKeyIdColumn(db: Db, table: string): void {
if (!hasColumn(db, table, 'key_id')) {
db.prepare(`ALTER TABLE ${table} ADD COLUMN key_id INTEGER`).run();
}
}
function dropKeyIdColumn(db: Db, table: string): void {
if (hasColumn(db, table, 'key_id')) {
db.prepare(`ALTER TABLE ${table} DROP COLUMN key_id`).run();
}
}
export function up(db: Db): void {
addKeyIdColumn(db, 'embedding_models');
addKeyIdColumn(db, 'media_models');
db.prepare('CREATE INDEX IF NOT EXISTS idx_embedding_models_key_id ON embedding_models(key_id)').run();
db.prepare('CREATE INDEX IF NOT EXISTS idx_media_models_key_id ON media_models(key_id)').run();
}
export function down(db: Db): void {
db.prepare('DROP INDEX IF EXISTS idx_embedding_models_key_id').run();
db.prepare('DROP INDEX IF EXISTS idx_media_models_key_id').run();
dropKeyIdColumn(db, 'media_models');
dropKeyIdColumn(db, 'embedding_models');
}