尚未收集仓库信息。
尚未检测到更新。GitHub 发布版本后会显示在这里。
soniq
翻译准备中
取自仓库 README
正在加载完整 README。
查看完整 README ↗Full-stack deployment: Vercel (serverless) + Supabase (auth + database).
soniq-vercel/
├── api/
│ ├── generate.js ← Anthropic proxy with auth + usage metering
│ ├── auth.js ← Signup / login / session endpoints
│ └── songs.js ← Cloud library CRUD
├── public/
│ └── index.html ← Full SONIQ app
├── supabase-schema.sql ← Run once in Supabase SQL editor
├── vercel.json
└── package.json
git init
git add .
git commit -m "SONIQ v1.0"
git remote add origin https://github.com/YOU/soniq.git
git push -u origin main
Vercel → your project → Settings → Environment Variables — add all 5:
| Variable | Where to find it |
|---|---|
| ANTHROPIC_API_KEY | console.anthropic.com → API Keys |
| SUPABASE_URL | Supabase → Settings → API → Project URL |
| SUPABASE_ANON_KEY | Supabase → Settings → API → anon public |
| SUPABASE_SERVICE_ROLE_KEY | Supabase → Settings → API → service_role |
| APP_URL | Your Vercel URL e.g. https://soniq.vercel.app |
After saving → Deployments → latest → Redeploy. Done.
SONIQ_AI_PROVIDER is optional: auto (default) tries Anthropic first when ANTHROPIC_API_KEY is configured, then OpenRouter; anthropic or openrouter forces one provider without fallback. The API Key dialog accepts personal sk-ant-... and sk-or-... keys, and hosted generation forwards a saved key to its matching provider.
On the hosted app, choose Use Local Qwen 3.6 (Ollama) from AI Provider to run prompt-based writing on the computer running the browser. This uses the local Ollama model qwen3.6:latest; Ollama must be running on port 11434. Because browser security requires an explicit CORS allowlist, on Windows set the user environment variable below, then fully quit and restart Ollama:
[Environment]::SetEnvironmentVariable('OLLAMA_ORIGINS', 'https://www.mysoniq.com,https://mysoniq.com', 'User')
[Environment]::SetEnvironmentVariable('OLLAMA_FLASH_ATTENTION', '1', 'User')
[Environment]::SetEnvironmentVariable('OLLAMA_KV_CACHE_TYPE', 'q8_0', 'User')
[Environment]::SetEnvironmentVariable('OLLAMA_NUM_PARALLEL', '1', 'User')
Tested on an RTX 5080 (16 GB) with Ollama 0.40.4: flash attention plus a q8_0 cache runs Qwen 3.6 at about 65-80 tokens/s with no CUDA crash (older builds crashed with flash attention on; if that returns, fall back to 0 / f16). Also keep the Ollama app's context-length slider at 16k or lower — 128k reserves so much memory that models spill onto the CPU. These are Ollama-wide settings.
Backup mode: once a browser has activated Local Qwen, switching back to Use SONIQ Cloud keeps Local Qwen armed as a backup. If the cloud AI fails (not sign-in, plan limits or a cancel), main Generate and prompt-based writing retry on this computer's Ollama and show a toast. Browsers that never activated Local Qwen never contact localhost.
Local-mode prompts are sent from the browser directly to Ollama, not to SONIQ's AI provider API. Use AI Provider → Use SONIQ Cloud to switch back. This browser-local option applies to prompt-based generation; server-side account, publishing, and other API features continue to use their existing endpoints.
npm install
Create .env.local (never commit):
ANTHROPIC_API_KEY=sk-ant-...
SUPABASE_URL=https://xxxx.supabase.co
SUPABASE_ANON_KEY=eyJ...
SUPABASE_SERVICE_ROLE_KEY=eyJ...
APP_URL=http://localhost:3000
npx vercel dev
# → open http://localhost:3000
| Plan | Songs/month | Library |
|---|---|---|
| Not signed in | 3/hour | localStorage |
| Free (signed in) | 5/month | Cloud sync |
| Pro ($9/mo) | Unlimited | Cloud sync |
Manually upgrade a user in Supabase:
UPDATE user_profiles SET plan = 'pro' WHERE email = '[email protected]';
Browser → POST /api/generate (Authorization: Bearer <jwt>)
→ Vercel Function verifies JWT with Supabase
→ Checks + increments usage counter
→ Calls Anthropic with your API key (server-side only)
→ Returns result
Your Anthropic API key never touches the browser. Ever.
Stripe quickstart: stripe.com/docs/billing/quickstart