MedgeClaw API Integration Guide: Configure Your Biomedical AI Research Assistant in 5 Minutes

March 15, 2026

WARNING

This article requires Node.js 22+ and a Docker environment.

Imagine this: you speak to a server, and it helps you analyze genomic data, screen drugs, and generate scientific charts—this is MedgeClaw. Built on OpenClaw and Claude Code, it is a biomedical AI research assistant integrated with 140 professional scientific skills.

Target Audience

  • Researchers in the life sciences field
  • Bioinformatics engineers requiring automated data analysis
  • University students looking to assist scientific research with AI

Introduction

The core of MedgeClaw is a conversational AI agent that executes analysis tasks via Claude Code as its underlying engine. You can send instructions through WhatsApp, Slack, Discord, or Feishu, and it will automatically:

  • Read and write local files
  • Execute Python/R code
  • Operate Docker containers
  • Generate visualization charts
  • Write scientific reports

The key is that MedgeClaw requires a model provider to function. While the official Anthropic API is used by default, it can be expensive. This article introduces various integration options, including Defapi, which provides official services at half the price.


Defapi is a model aggregation platform compatible with the OpenAI format, offering Claude series models at half the official price.

Why choose Defapi?

  • Price is only 50% of the official rate
  • Fully compatible with the Claude Code v1/chat/completions interface
  • Directly accessible from within China without a proxy

Configuration Steps

Step 1: Obtain API Key

Visit https://defapi.org, register an account, and obtain your API Key.

Step 2: Modify Configuration

Edit the .env file in the project root directory:

# Defapi Configuration
ANTHROPIC_API_KEY=dk-xxxxxxxxxxxxxxxx
ANTHROPIC_BASE_URL=https://api.defapi.org
MODEL=anthropic/claude-sonnet-4.5

# IMPORTANT: Required for Claude Code pre-flight check
ANTHROPIC_SMALL_FAST_MODEL=anthropic/claude-sonnet-4.5

Step 3: Run Installation Script

bash setup.sh

This will automatically complete the following operations:

  • Configure ~/.claude/settings.json
  • Build the Docker analysis environment (R + Python + RStudio + JupyterLab)
  • Synchronize MedgeClaw skills to OpenClaw

Step 4: Start Services

# Start the analysis environment
docker compose up -d

# Start OpenClaw
openclaw onboard

Method 2: Official Anthropic API

If you prioritize maximum stability, you can use the official interface directly.

# Official Anthropic API
ANTHROPIC_API_KEY=sk-ant-api03-xxxxxxxxxxxx
ANTHROPIC_BASE_URL=https://api.anthropic.com
MODEL=claude-sonnet-4-6
# No SMALL_FAST_MODEL configuration required

Method 3: OpenRouter

OpenRouter aggregates over 200+ models globally.

ANTHROPIC_API_KEY=sk-or-v1-xxxxxxxxxxxxxxxx
ANTHROPIC_BASE_URL=https://openrouter.ai/api/v1
MODEL=anthropic/claude-3.5-sonnet
ANTHROPIC_SMALL_FAST_MODEL=anthropic/claude-3.5-haiku

Method 4: MiniMax (Available in China)

If you are in China, MiniMax is an excellent choice.

ANTHROPIC_API_KEY=your_minimax_key
ANTHROPIC_BASE_URL=https://api.minimax.chat/anthropic
MODEL=minimax-2.1
ANTHROPIC_SMALL_FAST_MODEL=claude-sonnet-4-20250514

Method 5: Ollama (Local Deployment)

If you need to run completely offline, you can use Ollama.

# Install Ollama
curl -fsSL https://ollama.ai/install.sh | sh
ollama pull qwen2.5:14b

# Configuration
ANTHROPIC_API_KEY=ollama
ANTHROPIC_BASE_URL=http://localhost:11434/v1
MODEL=qwen2.5:14b

Verifying Operation

Once configured, run the following command to verify:

# Should complete within 30 seconds and return "hello"
claude --dangerously-skip-permissions -p 'run: echo hello'

If it hangs, it indicates that ANTHROPIC_SMALL_FAST_MODEL is configured incorrectly and the Claude Code pre-flight model is not supported by the current API.


Internal Mechanism: Why is a Pre-flight Model Needed?

This is an interesting design. Before executing any bash command, Claude Code uses a lightweight model (defaulting to Haiku) to perform a safety check to identify potential malicious operations:

# Pseudo-code: Pre-flight logic
async def preflight_check(command: str) -> bool:
    # Analyze command intent using a lightweight model
    model = os.environ.get("ANTHROPIC_SMALL_FAST_MODEL", "claude-3-5-haiku")
    result = await call_api(model, f"Is this command safe? {command}")
    return result.safety_score > 0.8

This leads to an issue: most third-party APIs do not support Haiku, as it is an Anthropic-exclusive model. This is why ANTHROPIC_SMALL_FAST_MODEL must be configured when using proxies.


5 Common Use Cases

1. RNA-seq Differential Expression Analysis

Analyze RNA-seq data at data/counts.csv vs data/meta.csv, treatment vs control

MedgeClaw will automatically:

  • Load the count matrix
  • Run DESeq2/edgeR differential analysis
  • Generate volcano plots and heatmaps
  • Output a list of significantly differentially expressed genes

2. Clinical Survival Analysis

Run survival analysis on data/clinical.csv, time=OS_months, event=OS_status

Automatically executes Kaplan-Meier curves and Cox proportional hazards models.

3. Single-cell RNA-seq Clustering

Perform single-cell RNA-seq analysis on the 10X data in data/10x/

Uses Scanpy to complete dimensionality reduction, clustering, and marker identification.

4. Virtual Drug Screening

Virtual screen EGFR inhibitors from ChEMBL (IC50 < 50nM), generate SAR report

Screens compounds from the ChEMBL database and generates Structure-Activity Relationship (SAR) reports.

5. Literature Review Generation

Search PubMed for recent papers on CRISPR base editing, summarize top 10

Automatically searches PubMed and generates literature summaries and analysis.

Updated March 15, 2026