AnyBio
Guides

Claude Code Integration

Use Claude Code (Anthropic's coding agent) to build AnyBio-powered apps. This guide covers setting up an ANYBIO.md context file so Claude Code understands the platform, and prompt patterns for common tasks.

Prerequisites

  • An AnyBio account with a project key (proj_*) and an API key (org_*)
  • Claude Code CLI installed
  • A project you want to add biosignal capabilities to

Step 1: Add ANYBIO.md

Create an ANYBIO.md file at your project root. Claude Code automatically reads markdown files as context.

Download the template: ANYBIO.md for Claude Code

Or create it manually:

# AnyBio Integration

## What is AnyBio?
Biosignal infrastructure platform. Handles BLE device connectivity, real-time signal processing,
FHIR output, and clinical AI. You build the product — AnyBio handles the pipeline.

## Authentication
- `org_*` key: Server-side only. Used to mint tokens and manage resources.
- `proj_*` key: Identifies your project. Used alongside org key.
- `sdk_*` key: Browser-safe. Limited to bootstrap and widget initialization.
- XUser token: Short-lived JWT (1hr). Minted server-side via POST /api/v1/sdk/token.

IMPORTANT: Never put org_* keys in client-side code.

## API Base URL
https://api.anybio.io

## Key Endpoints
- POST /api/v1/sdk/token — Mint xuser token (body: { external_id, project_key })
- GET  /api/v1/xusers — List users
- GET  /api/v1/episodes — List episodes (query: xuser_id, from, to)
- GET  /api/v1/episodes/:id — Episode detail with artifacts
- POST /api/v1/charts/query — Chart data query
- GET  /api/v1/admin/usage/summary — BPU usage summary
- OpenAPI spec: https://api.anybio.io/api-docs

## BioUI Web (browser widgets)
CDN-based, zero build step. Add to any HTML page:

<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" />

<bio-provider api-key="org_*" project-key="proj_*" xuser-id="user-123">
  <bio-health-metrics></bio-health-metrics>
</bio-provider>

Available widgets: bio-health-metrics, bio-mood, bio-checkin, bio-journal,
bio-task-list, bio-progress-ring, bio-trend-card, bio-trend-chart

## BioSDK (iOS)
Swift Package: https://github.com/anybio/biosdk-ios-binary.git

import BioSDK
let sdk = try await BioSDKClient.initialize(
    configuration: .auto(organizationKey: "org_*", projectKey: "proj_*"))
sdk.startScan()
sdk.connect(sdk.discoveredDevices.first!)
sdk.startStreaming(for: "user-id")

## Security Rules
- org_* keys are server-side only
- Mint xuser tokens via server-side route, pass to client
- All /api/v1/* endpoints require authentication

Step 2: Use Claude Code with AnyBio

With ANYBIO.md in your project, Claude Code has full context. Start a session and try:

Adding BioUI Web widgets

Add AnyBio health monitoring widgets to my Next.js app. Create a server-side
API route at /api/anybio-token that mints xuser tokens, then add a dashboard
page with bio-health-metrics and bio-mood widgets that initialize after login.

Building an iOS app

Create a SwiftUI view that uses BioSDK to scan for BLE devices, display them
in a list, connect on tap, and show real-time heart rate. Use the events
publisher to handle .sample events.

Fetching episodes and clinical data

Add an episodes page that fetches episodes from the AnyBio API for the current
user. Show each episode's type, duration, attention score, and link to any
artifact PDFs. Use the /api/v1/episodes endpoint.

Creating a usage dashboard

Add a usage page that shows the org's BPU consumption. Call
/api/v1/admin/usage/summary and display a progress bar against the plan limit,
plus a breakdown by category (data ingest, session time, AI, clinical output).

Step 3: Using with /docs Context

You can tell Claude Code to fetch the docs directly:

Read the AnyBio BioUI Web quickstart at https://docs.anybio.io/bioui-web/quickstart
and implement that pattern in my app.

Or reference the OpenAPI spec:

Fetch the OpenAPI spec at https://api.anybio.io/api-docs and create TypeScript
types for the Episode and XUser models.

Tips

  • Claude Code reads ANYBIO.md automatically — keep it at your project root
  • Be specific about server vs. client — say "create a server-side API route" to prevent key leakage
  • Iterate on errors — paste error output and Claude Code will fix with AnyBio context
  • Use for boilerplate — token minting routes, widget initialization, data fetching are great tasks
  • Review security — always verify that org_* keys are not in client bundles

Troubleshooting

IssueSolution
Claude Code doesn't know AnyBio APIsCheck that ANYBIO.md is at your project root, not in a subdirectory.
Generated code puts org_* key in clientTell it: "The org key must stay server-side. Create an API route to mint xuser tokens."
Authentication errors (401/403)Verify you're using the right key type. Widget endpoints need xuser tokens, admin endpoints need org keys.
Widgets don't renderEnsure CDN script is loaded before widgets, and <bio-provider> wraps all widget elements.

Next Steps

On this page