AnyBio
Guides

AI Prompt Templates

Copy-paste prompts for building with AnyBio using any AI coding tool — Cursor, Claude Code, ChatGPT, Lovable, Bolt, or others. Each prompt is self-contained with the context needed to produce working code.

Web App: Add Health Widgets

Works with: Cursor, Claude Code, ChatGPT, Bolt

I'm building a web app and want to add AnyBio health monitoring widgets.

AnyBio BioUI Web uses CDN-based Web Components:
- Script: https://cdn.anybio.io/biosdk-web/v1/bioui.js
- CSS: https://cdn.anybio.io/biosdk-web/v1/bioui-base.css

Authentication model:
- Server-side: POST https://api.anybio.io/api/v1/sdk/token with
  Authorization: Bearer org_MY_KEY and body { external_id: "user-id", project_key: "proj_MY_KEY" }
  Returns: { xuser_token: "eyJ...", xuser_id: "...", expires_in: 3600 }
- Client-side: Pass xuser_token to <bio-provider xuser-token="eyJ...">

Available widgets: <bio-health-metrics>, <bio-mood>, <bio-checkin>,
<bio-journal>, <bio-task-list>, <bio-progress-ring>

Please:
1. Create a server-side route that mints xuser tokens (keep org_* key server-side only)
2. Add the CDN script and CSS to my page
3. Initialize <bio-provider> with the token after user login
4. Add <bio-health-metrics> and <bio-mood> widgets to my dashboard

My framework is [Next.js / React / Vue / plain HTML — specify yours].

iOS App: BLE Device Streaming

Works with: Cursor, Claude Code, ChatGPT

I'm building an iOS app that streams biosignals from BLE wearables using AnyBio's BioSDK.

BioSDK setup:
- Swift Package: https://github.com/anybio/biosdk-ios-binary.git
- Info.plist: NSBluetoothAlwaysUsageDescription, UIBackgroundModes: bluetooth-central

SDK usage:
import BioSDK
let sdk = try await BioSDKClient.initialize(
    configuration: .auto(organizationKey: "org_*", projectKey: "proj_*"))
sdk.startScan()                              // Scan for BLE devices
sdk.connect(device)                          // Connect to a BioDevice
sdk.startStreaming(for: "user-id")           // Start streaming data
sdk.events.sink { event in ... }             // Receive samples via Combine

Event types: .lifecycle(.discovered/.connected/.disconnected),
.sample(deviceId, sample), .deviceState(device, connection, stream)

Please create a SwiftUI app with:
1. A device list view showing discovered BLE devices
2. Tap to connect, showing connection state
3. A real-time heart rate display from .sample events
4. Start/stop streaming controls

Lovable: Full Wellness App

Works with: Lovable

Build a wellness app with AnyBio health widgets using Supabase for auth.

Follow this integration pattern:
1. Create a Supabase Edge Function at supabase/functions/anybio-auth/index.ts
   that verifies the Supabase session, then calls POST https://api.anybio.io/api/v1/sdk/token
   with Authorization: Bearer [ANYBIO_PROJECT_KEY from secrets] and body
   { external_id: user.id, project_key: [ANYBIO_PROJECT_KEY_ID from secrets] }

2. Add BioUI Web CDN to the app:
   <script src="https://cdn.anybio.io/biosdk-web/v1/bioui.js"></script>
   <link rel="stylesheet" href="https://cdn.anybio.io/biosdk-web/v1/bioui-base.css" />

3. After login, call the Edge Function to get a token, then set it on <bio-provider>

4. Add these pages:
   - Dashboard: <bio-health-metrics> + <bio-progress-ring> + <bio-mood>
   - Check-in: <bio-checkin> for daily health questionnaires
   - Journal: <bio-journal> for daily reflections

The app should have a clean, modern design with a bottom tab bar.

API: Fetch Episodes and Artifacts

Works with: Cursor, Claude Code, ChatGPT

I need to fetch clinical episode data from AnyBio's REST API.

Base URL: https://api.anybio.io
Auth: Authorization: Bearer org_MY_KEY (or xuser token for user-scoped access)

Endpoints:
- GET /api/v1/episodes?xuser_id={id}&from={iso}&to={iso} → list of episodes
- GET /api/v1/episodes/{id} → episode detail with artifacts array
- Each artifact has: type (ecg_strip_pdf, fhir_bundle, etc.), signed_url, created_at

Please create:
1. A TypeScript API client with functions for listEpisodes() and getEpisode()
2. An episodes list component showing type, duration, attention score (0-100)
3. An episode detail view with artifact download links
4. Error handling for 401 (auth) and 404 (not found)

My framework is [specify yours].

API: Usage Dashboard

Works with: Cursor, Claude Code

I need to display AnyBio BPU (Biosignal Processing Unit) usage for my organization.

Endpoint: GET https://api.anybio.io/api/v1/admin/usage/summary?window=30d
Auth: Authorization: Bearer org_MY_KEY (admin scope required)

Response shape:
{
  plan: { tier: "sandbox", tier_display: "Sandbox", included_credits: 25000 },
  credits: { total, data_ingest, session_time, signal_processing, ai_usage, model_inference, clinical_output },
  ingest_gb: number, session_hours: number, active_xusers: number
}

Please create a usage dashboard page with:
1. A progress bar showing total BPU used vs plan limit
2. Category breakdown cards (Data Ingest, Session Time, AI/ML, Clinical Output, Active Users)
3. Color-coded progress (blue <75%, amber 75-90%, red >90%)

Episode Profile: Conversational AI

Works with: Cursor, Claude Code, ChatGPT

AnyBio has a Profile Authoring Agent — a conversational AI that helps design
episode detection profiles (what biosignal patterns to detect and when to
create clinical episodes).

The endpoint is:
- POST /api/v1/profile-authoring/start → starts a new conversation
- POST /api/v1/profile-authoring/conversations/{id}/stream → SSE streaming

Please create a chat interface that:
1. Starts a profile authoring session on mount
2. Displays the streaming AI responses in real time (SSE)
3. Shows a text input for the user to describe what they want to detect
4. Has a clean chat bubble UI with user messages on the right, AI on the left

Example opening prompt to the agent:
"I want to detect when a patient's heart rate stays above 100 bpm for more
than 10 minutes while they're at rest (low motion). This should create a
resting tachycardia episode."

Tips for All Tools

  1. Always specify your framework — the same task produces very different code for Next.js vs. plain HTML vs. SwiftUI
  2. Mention "server-side" for token minting — AI tools default to client-side code which leaks keys
  3. Paste errors back — AI tools are great at debugging their own output with AnyBio context
  4. Start with one widget — get <bio-health-metrics> working first, then add more
  5. Reference the docs — tell the tool to read https://docs.anybio.io for details

Next Steps

On this page