AI Engineering Workspace
PartialChat, files, terminal and preview in one place. Chat sessions run on a durable Postgres-backed queue (chat only: no tools or shell). Live models need an API key; the terminal is unavailable.
Project files
read-only- ..
- assets
- basic-languages
- editor
- language
- nls
- abap-D-t0cyap.js
- apex-CcIm7xu6.js
- azcli-BA0tQDCg.js
- bat-C397hTD6.js
- bicep-DF5aW17k.js
- cameligo-plsz8qhj.js
- clojure-Y2auQMzK.js
- coffee-Bu45yuWE.js
- cpp-CkKPQIni.js
- csharp-CX28MZyh.js
- csp-D8uWnyxW.js
- css-CaeNmE3S.js
- css.worker-C7XcYe5x.js
- cssMode-DpEkhVlW.js
- cypher-DVThT8BS.js
- dart-CmGfCvrO.js
- dockerfile-CZqqYdch.js
- ecl-30fUercY.js
- editor-CG9c2pE-.js
- editor.js
- elixir-O3PRlgxO.js
- flow9-DqtmStfK.js
- freemarker2-DTUDMAl2.js
- fsharp-BOMdg4U1.js
- go-D_hbi-Jt.js
- graphql-CKUU4kLG.js
- handlebars-qLqoXa-4.js
- hcl-DTaboeZW.js
- html-DTxBj26n.js
- html.worker-VIR_LTyv.js
- htmlMode-DFBg6CMj.js
- index-BVflv2uG.js
- index.js
- ini--YXggpAu.js
- java-CI4ZMsH9.js
- javascript-BiL3JN6i.js
- json.worker-DzWXGkG8.js
- jsonMode-Dz4r0pwo.js
- julia-BwzEvaQw.js
- kotlin-IUYPiTV8.js
- less-C0eDYdqa.js
- lexon-iON-Kj97.js
- liquid-lXEUQRVn.js
- loader.js
- lspLanguageFeatures-IeRAvoKK.js
- lua-DtygF91M.js
- m3-CsR4AuFi.js
- markdown-C_rD0bIw.js
- mdx-Dtr248s4.js
- mips-CiYP61RB.js
- monaco.contribution-BRs4bdz5.js
- monaco.contribution-ChoOM5Gg.js
- monaco.contribution-DbKqsbmO.js
- monaco.contribution-DKFaWvum.js
- msdax-C38-sJlp.js
- mysql-CdtbpvbG.js
- nls.messages-loader.js
- objective-c-CntZFaHX.js
- pascal-r6kuqfl_.js
- pascaligo-BiXoTmXh.js
- perl-DABw_TcH.js
- pgsql-me_jFXeX.js
- php-D_kh-9LK.js
- pla-VfZjczW0.js
- postiats-BBSzz8Pk.js
- powerquery-Dt-g_2cc.js
- powershell-B-7ap1zc.js
- protobuf-BmtuEB1A.js
- pug-BRpRNeEb.js
- python-Cma5OvNe.js
- qsharp-BzsFaUU9.js
- r-f8dDdrp4.js
- razor-C8pOqqry.js
- redis-fvZQY4PI.js
- redshift-45Et0LQi.js
- restructuredtext-C7UUFKFD.js
- ruby-CZO8zYTz.js
- rust-Bfetafyc.js
- sb-3GYllVck.js
- scala-foMgrKo1.js
- scheme-CHdMtr7p.js
- scss-C1cmLt9V.js
- shell-ClXCKCEW.js
- solidity-MZ6ExpPy.js
- sophia-DWkuSsPQ.js
- sparql-AUGFYSyk.js
- sql-32GpJSV2.js
- st-CuDFIVZ_.js
- swift-t-PfMj7W.js
- systemverilog-Ch4vA8Yt.js
- tcl-D74tq1nH.js
- toggleHighContrast-CmI6H2gJ.js
- ts.worker-Dp2_QI6H.js
- tsMode-DgC3tGu_.js
- twig-C6taOxMV.js
- typescript-PjDChiYw.js
- typespec-D-PIh9Xw.js
- vb-Dyb2648j.js
- wgsl-BhLXMOR0.js
- workers-B_Zs9c54.js
- xml-BgCkTIhY.js
- yaml-D0tu26m-.js
app/src/lib/providers.ts
1// Provider registry, pricing estimates and real credential verification (read-only API calls).2import { db, now } from "./db";3import { decrypt, encrypt, hintOf } from "./crypto";45export type ProviderId = "anthropic" | "openai" | "github" | "cloudflare" | "godaddy" | "hostinger" | "digitalocean";6export const INTEGRATIONS: { id: ProviderId; name: string; desc: string; ai?: boolean }[] = [7 { id: "anthropic", name: "Anthropic", desc: "Claude models via the Messages API (API key)", ai: true },8 { id: "openai", name: "OpenAI", desc: "GPT models via Chat Completions (API key)", ai: true },9 { id: "github", name: "GitHub", desc: "Source hosting (personal access token)" },10 { id: "cloudflare", name: "Cloudflare", desc: "DNS & CDN (API token)" },11 { id: "godaddy", name: "GoDaddy", desc: "Registrar & DNS (key:secret)" },12 { id: "hostinger", name: "Hostinger", desc: "VPS provider (API token)" },13 { id: "digitalocean", name: "DigitalOcean", desc: "Cloud nodes (API token)" },14];1516// ESTIMATES in USD per 1M tokens. Operator-editable via setting `ai.pricing`; provider invoices are authoritative.17export const DEFAULT_PRICING: Record<string, { in: number; out: number }> = {18 "claude-sonnet-5-5": { in: 3, out: 15 }, "claude-opus-5-5": { in: 15, out: 75 }, "claude-haiku-5-5": { in: 1, out: 5 },19 "gpt-4o": { in: 2.5, out: 10 }, "gpt-4o-mini": { in: 0.15, out: 0.6 }, "mock-1": { in: 0, out: 0 },20};21export const MODELS: Record<string, string[]> = { anthropic: ["claude-sonnet-5-5", "claude-opus-5-5", "claude-haiku-5-5"], openai: ["gpt-4o", "gpt-4o-mini"], mock: ["mock-1"] };22export const mockAllowed = () => process.env.ZCS_ALLOW_MOCK === "1";2324const probe: Record<ProviderId, (k: string) => { url: string; headers: Record<string, string> }> = {25 anthropic: k => ({ url: "https://api.anthropic.com/v1/models?limit=1", headers: { "x-api-key": k, "anthropic-version": "2023-06-01" } }),26 openai: k => ({ url: "https://api.openai.com/v1/models", headers: { authorization: `Bearer ${k}` } }),27 github: k => ({ url: "https://api.github.com/user", headers: { authorization: `Bearer ${k}`, "user-agent": "zoo-cloud-studio", accept: "application/vnd.github+json" } }),28 cloudflare: k => ({ url: "https://api.cloudflare.com/client/v4/user/tokens/verify", headers: { authorization: `Bearer ${k}` } }),29 godaddy: k => ({ url: "https://api.godaddy.com/v1/domains?limit=1", headers: { authorization: `sso-key ${k}` } }),30 hostinger: k => ({ url: "https://developers.hostinger.com/api/vps/v1/virtual-machines", headers: { authorization: `Bearer ${k}` } }),31 digitalocean: k => ({ url: "https://api.digitalocean.com/v2/account", headers: { authorization: `Bearer ${k}` } }),32};3334/** "verified" only on a real 2xx from the provider. Network failure => "error", never faked. */35export async function verifyKey(id: ProviderId, key: string): Promise<{ status: "verified" | "invalid" | "error"; detail: string }> {36 const p = probe[id](key);37 try {38 const r = await fetch(p.url, { headers: p.headers, signal: AbortSignal.timeout(10_000), redirect: "error" });39 if (r.ok) return { status: "verified", detail: `HTTP ${r.status}` };40 if (r.status === 401 || r.status === 403) return { status: "invalid", detail: `HTTP ${r.status} (rejected)` };41 return { status: "error", detail: `HTTP ${r.status}` };42 } catch (e) { return { status: "error", detail: `network: ${(e as Error).name}` }; }43}4445export async function saveCredential(orgId: string, id: ProviderId, key: string) {46 const e = encrypt(key); const v = await verifyKey(id, key);47 await db().prepare(`INSERT INTO credentials(id,provider,ciphertext,iv,tag,hint,verified_at,status,updated_at,org_id) VALUES(?,?,?,?,?,?,?,?,?,?)48 ON CONFLICT(org_id,provider) DO UPDATE SET ciphertext=excluded.ciphertext, iv=excluded.iv, tag=excluded.tag, hint=excluded.hint, verified_at=excluded.verified_at, status=excluded.status, updated_at=excluded.updated_at`)49 .run(`cred_${orgId}_${id}`, id, e.ciphertext, e.iv, e.tag, hintOf(key), v.status === "verified" ? now() : null, v.status, now(), orgId);50 return v;51}52export async function credentialStatus(orgId: string) {53 const rows = await db().prepare("SELECT provider,hint,status,verified_at,updated_at FROM credentials WHERE org_id=?").all(orgId) as any[];54 return Object.fromEntries(rows.map(r => [r.provider, { hint: r.hint, status: r.status, verified_at: r.verified_at, updated_at: r.updated_at }]));55}56export async function revealKey(orgId: string, id: ProviderId): Promise<string | null> {57 const r = await db().prepare("SELECT ciphertext,iv,tag FROM credentials WHERE provider=? AND org_id=?").get(id, orgId) as any; return r ? decrypt(r) : null;58}59
Conversation
PartialSign in to start AI sessions.
Task checklist
- Application shell deployed
- Persistent projects
- Agent runtime
- Sandboxed terminal
Execution activity
No agent sessions. Git HEAD 692573d on master.
Approval requests
None pending.