Skip to content

Myna Studio AI writer: c0mpute first, OpenAI/Anthropic fallback billed at 2x (v0.58.0) - #200

Open
ralyodio wants to merge 1 commit into
mainfrom
feat/studio-ai-fallback
Open

ralyodio wants to merge 1 commit into
mainfrom
feat/studio-ai-fallback

Conversation

@ralyodio

Copy link
Copy Markdown
Contributor

House rule (2026-11-30): AI on c0mpute first, OpenAI/Anthropic when c0mpute fails or is too slow.

Myna Studio's AI writer now calls c0mpute.com POST /api/v1/ai/text (profullstack/c0mpute#600) instead of /v1/chat/completions:

  • c0mpute first, billed by the network at its rates, as before.
  • When no node starts writing within about 20 s, c0mpute.com has OpenAI or Anthropic write the drafts (@profullstack/ai-providers; the paid keys live in c0mpute's vault, not here) and charges the person's balance 2x that provider's list-price cost as Infernet usage kind ai.fallback (usage-charge: house kinds ai.fallback and social.plan InfernetProtocol/infernet-protocol#285), idempotent on a per-draft idem_key. A fallback answer is only returned once the charge went through.
  • The writer shows who wrote it: "Written on the c0mpute network (model)" or "Written by anthropic claude-haiku-5-5 (the c0mpute network was busy); $X charged to your c0mpute balance (2x its cost)."

complete() returns { text, provider, model, billed }; /ai/write returns those next to drafts. Docs updated. v0.58.0 (core, cli, mcp, version.ts).

Tests: bun test apps/api/test/studio.test.ts apps/api/test/studio.integration.test.ts (20 pass), the release test line (929 pass), tsc --noEmit clean. (apps/api/test/openconnection.test.ts "forums come from nichedb" fails on main too: the board name in its fixture changed; not this PR.)

🤖 Generated with Claude Code

…c0mpute /api/v1/ai/text; v0.58.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

ThreatCrush Security Scan

1 finding(s) in the 10 file(s) this pull request changes.

MEDIUM: 1

Severity Rule Location
MEDIUM insecure-randomness-for-secret apps/web/assets/studio.js:620
155 pre-existing finding(s) elsewhere in the repository — **HIGH**: 5 | **MEDIUM**: 110 | **LOW**: 40

Not introduced by this pull request.

Severity Rule Location
HIGH secret-database-url README.md:1556
HIGH secret-database-url README.md:1646
HIGH js-electron-node-integration apps/desktop/src/main.cjs:33
HIGH js-ssrf-outbound-request apps/web/src/proxy.ts:61
HIGH secret-database-url docker-compose.yml:4
MEDIUM gha-ssh-key-secret .github/workflows/deploy-dev2.yml:39
MEDIUM sql-template-interpolation apps/api/src/atproto.ts:63
MEDIUM sql-template-interpolation apps/api/src/atproto.ts:101
MEDIUM sql-template-interpolation apps/api/src/atproto.ts:121
MEDIUM sql-template-interpolation apps/api/src/cloud.ts:51
MEDIUM sql-template-interpolation apps/api/src/cloud.ts:118
MEDIUM sql-template-interpolation apps/api/src/cloud.ts:133
MEDIUM sql-template-interpolation apps/api/src/cloud.ts:134
MEDIUM sql-template-interpolation apps/api/src/cloud.ts:135
MEDIUM sql-template-interpolation apps/api/src/cloud.ts:138
MEDIUM sql-template-interpolation apps/api/src/cloud.ts:168
MEDIUM sql-template-interpolation apps/api/src/cloud.ts:175
MEDIUM sql-template-interpolation apps/api/src/cloud.ts:182
MEDIUM sql-template-interpolation apps/api/src/credits.ts:132
MEDIUM sql-template-interpolation apps/api/src/credits.ts:166

…and 135 more; the full set is in the SARIF artifact.

Snippets are redacted; ThreatCrush never prints matched credential material.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant