MCP Server & SDK
BiOS provides three ways to automate fine-tuning programmatically: an MCP server for AI assistants (Claude, Cursor, Windsurf), a TypeScript SDK and Python SDK for application code, and a REST API (documented in previous sections). All three use API keys created from your dashboard.
API Keys
All programmatic access requires an API key. Each key is scoped to a workspace with fine-grained permissions. You only need the API key itself. Org and workspace are resolved automatically.
- Go to your dashboard and click API Keys in the sidebar
- Click Create API Key, name it, and choose a permission preset (Read Only, Training, Full Access, or Custom)
- Optionally set an expiration (30, 60, 90, 180 days, or 1 year)
- Copy the key immediately; it is only shown once
- Set the key as
USFBIOS_API_KEY. Nothing else is needed
Permission Scopes
Call GET /api/api-keys/introspect with your key to see exactly what it can do: permissions, workspace, allowed tools, and rate limits.
X-API-Key header. The key embeds your org and workspace, no separate IDs needed. If a member is removed from a workspace, all their keys for that workspace are automatically revoked.MCP Server
The Model Context Protocol (MCP) is an open standard that lets AI assistants call external tools. The BiOS MCP server gives your AI assistant 38 tools covering the entire fine-tuning workflow, from datasets to training to inference. It works with Claude Desktop, Claude Code, Cursor, Windsurf, Cline, VS Code, Zed, Devin, and any MCP-compatible client.
Web and mobile apps such as claude.ai and ChatGPT connect through the hosted connector at https://mcp.usbios.ai/mcp instead: you sign in with your BiOS account and approve the connection, with no install and no API key.
For local setups, install globally or run with npx:
npm install -g @usfbios/mcp-server
# or run directly:
npx @usfbios/mcp-serverClient Setup Guides
We publish a dedicated step-by-step guide for every major MCP client, each with the exact config file location, verification steps, and troubleshooting:
Or start from the MCP server overview for the quick start that applies to any client.
Configuration
Add to your AI client's configuration.
Claude Desktop / Claude Code
Add this to your claude_desktop_config.json or the project's .mcp.json:
{
"mcpServers": {
"usfbios": {
"command": "npx",
"args": ["@usfbios/mcp-server"],
"env": {
"USFBIOS_API_KEY": "sk_live_your_api_key"
}
}
}
}Cursor / Windsurf
Add the same configuration to your .cursor/mcp.json or the IDE's MCP settings panel.
Environment Variables
| Variable | Required | Description |
|---|---|---|
| USFBIOS_API_KEY | Required | Your scoped API key from the dashboard (starts with sk_live_). Org and workspace are resolved automatically. |
| USFBIOS_BASE_URL | Optional | API base URL (default: https://api.usbios.ai) |
Available Tools
The MCP server exposes 38 tools organized by category. The most used ones are documented below; the inference tools mirror the Inference API. Your AI assistant can call any of them:
Context(2 tools)
get_platform_guideComplete platform guide with 9 topics: overview, quick_start, models, datasets, training_methods, gpu_selection, hyperparameters, monitoring, cost_optimization. Call this FIRST so your AI assistant understands the full platform.
| Name | Type | Required | Description |
|---|---|---|---|
| topic | string | Optional | "overview" | "quick_start" | "models" | "datasets" | "training_methods" | "gpu_selection" | "hyperparameters" | "monitoring" | "cost_optimization" |
introspect_api_keyDiscover what this API key can do. Returns permissions (scopes), bound org/workspace, allowed MCP tools, allowed SDK methods, rate limits, and expiration. Call this to understand your access level.
Billing(1 tools)
get_wallet_balanceCheck wallet balance, available credits, pending charges, and auto top-up status. Call before training to verify you have enough credits.
Models(2 tools)
search_modelsSearch 250+ base models. Filter by name, provider, or max parameter count.
| Name | Type | Required | Description |
|---|---|---|---|
| query | string | Optional | Model name (e.g., "llama", "mistral") |
| provider | string | Optional | Provider (e.g., "meta-llama") |
| max_params | string | Optional | Max params (e.g., "13B") |
get_model_configGet training config recommendations for a model: supported methods, recommended GPU, default hyperparameters, estimated cost.
| Name | Type | Required | Description |
|---|---|---|---|
| model | string | Required | Full model name |
GPU(2 tools)
get_gpu_pricingAll GPU types with per-second pricing, VRAM, and availability. No auth required.
get_recommended_gpuOptimal GPU for a model+adapter combo. Returns minimum GPU, recommended GPU, estimated time, and estimated cost.
| Name | Type | Required | Description |
|---|---|---|---|
| model | string | Required | Model name |
| adapter | string | Optional | "lora" | "qlora" | "full" |
| dataset_rows | number | Optional | Row count for cost estimation |
| epochs | number | Optional | Planned epochs |
Datasets(5 tools)
list_datasetsList all datasets: ID, name, format, row count, size, columns, date.
upload_datasetUpload a local file (JSONL/Parquet/CSV, max 500MB). Auto-validates format and schema.
| Name | Type | Required | Description |
|---|---|---|---|
| file_path | string | Required | Absolute path to file |
| name | string | Optional | Display name |
preview_datasetPreview first rows to verify structure and content before training.
| Name | Type | Required | Description |
|---|---|---|---|
| dataset_id | string | Required | Dataset ID |
| rows | number | Optional | Rows to preview (max 50) |
delete_datasetPermanently delete a dataset. Active training jobs are not affected.
| Name | Type | Required | Description |
|---|---|---|---|
| dataset_id | string | Required | Dataset ID |
import_huggingface_datasetImport from HuggingFace Hub (public or private if HF account connected).
| Name | Type | Required | Description |
|---|---|---|---|
| repo_id | string | Required | HF repo (e.g., "databricks/dolly-15k") |
| split | string | Optional | Split (default: "train") |
| max_samples | number | Optional | Max rows |
| name | string | Optional | Display name |
Training(8 tools)
create_training_jobLaunch a fine-tuning job. Bills per-second. Only model, dataset_id, and method are required; everything else has sensible defaults.
| Name | Type | Required | Description |
|---|---|---|---|
| model | string | Required | Base model name |
| dataset_id | string | Required | Dataset ID |
| method | string | Required | "sft" | "dpo" | "simpo" | "orpo" | "cpo" | "kto" | "cpt" | "vlm" |
| adapter | string | Optional | "lora" | "qlora" | "full" (default: "lora") |
| gpu_type | string | Optional | GPU type (auto-selected if omitted) |
| epochs | number | Optional | Epochs (default: 3) |
| learning_rate | number | Optional | LR (default: 2e-4) |
| batch_size | number | Optional | Batch size (default: 4) |
| lora_rank | number | Optional | LoRA rank (default: 16) |
| job_name | string | Optional | Display name |
list_training_jobsList all jobs with status, progress, model, method, GPU, cost, timestamps.
| Name | Type | Required | Description |
|---|---|---|---|
| status | string | Optional | "running" | "completed" | "stopped" | "queued" |
get_training_statusDetailed status: progress %, step/total, loss, LR, elapsed time, ETA, GPU utilization.
| Name | Type | Required | Description |
|---|---|---|---|
| job_id | string | Required | Job ID |
get_training_metricsMetrics history: loss curve, eval loss, learning rate schedule, eval results.
| Name | Type | Required | Description |
|---|---|---|---|
| job_id | string | Required | Job ID |
get_training_logsRaw training output logs. Shows progress, warnings, checkpoint saves, eval results.
| Name | Type | Required | Description |
|---|---|---|---|
| job_id | string | Required | Job ID |
| tail | number | Optional | Recent lines (default: 100) |
stop_training_jobStop a running job. Checkpoints preserved, billing stops instantly. Can resume later.
| Name | Type | Required | Description |
|---|---|---|---|
| job_id | string | Required | Job ID |
resume_training_jobResume from last checkpoint. No data lost, no epochs repeated.
| Name | Type | Required | Description |
|---|---|---|---|
| job_id | string | Required | Job ID |
get_training_checkpointsList saved checkpoints with step number, metrics, and download URL.
| Name | Type | Required | Description |
|---|---|---|---|
| job_id | string | Required | Job ID |
Usage Examples
Once connected, you can ask your AI assistant to perform fine-tuning tasks in natural language. Here are some example prompts:
"Search for Llama models under 13B parameters"
Tools used: search_models
"Upload my customer-support.jsonl dataset and start an SFT job on Llama 3.1 8B with LoRA"
Tools used: upload_dataset → create_training_job
"What's the status of my running training jobs?"
Tools used: list_training_jobs
"Show me the training loss for job job_abc123"
Tools used: get_training_metrics
"Import the databricks/dolly-15k dataset from HuggingFace and fine-tune Mistral 7B using DPO"
Tools used: import_huggingface_dataset → create_training_job
"Stop the training job that's been running longest"
Tools used: list_training_jobs → stop_training_job
End-to-End Fine-Tuning Example
This example shows the complete flow, from finding a model to launching a training job, as a single conversation with your AI assistant:
User: I have a customer support dataset at ~/data/support-qa.jsonl.
Fine-tune Llama 3.1 8B on it using SFT with LoRA. Use default hyperparameters.
Assistant calls: search_models(query="Llama 3.1 8B")
→ Found: meta-llama/Llama-3.1-8B-Instruct (8B params)
Assistant calls: upload_dataset(file_path="~/data/support-qa.jsonl")
→ Uploaded: ds_abc123 (12,450 rows, JSONL, validated)
Assistant calls: get_gpu_pricing()
→ Recommended: A100 80GB at $2.49/hr for 8B model
Assistant calls: create_training_job(
model="meta-llama/Llama-3.1-8B-Instruct",
dataset_id="ds_abc123",
method="sft",
adapter="lora",
gpu_type="A100_80GB"
)
→ Job launched: job_def456 (estimated 2-3 hours, ~$6.50)TypeScript / JavaScript SDK
For application code, use the @usfbios/sdk package:
npm install @usfbios/sdkimport { USFBios } from '@usfbios/sdk';
const client = new USFBios({
apiKey: 'sk_live_...', // from Dashboard → API Keys (that's all you need)
});
// Discover what your key can do
const info = await client.introspect();
console.log(info.scopes); // ['models:read', 'datasets:write', ...]
console.log(info.org.name); // "Arpit's Org"
// Search models
const models = await client.models.search({ query: 'llama 8B' });
// Upload a dataset
const ds = await client.datasets.upload({
filePath: './support-qa.jsonl',
name: 'Customer Support QA'
});
// Check wallet balance
const balance = await client.wallet.getBalance();
// Get GPU recommendation
const gpu = await client.gpu.getRecommended(
'meta-llama/Llama-3.1-8B-Instruct'
);
// Launch fine-tuning
const job = await client.training.create({
model: 'meta-llama/Llama-3.1-8B-Instruct',
datasetId: ds.id,
method: 'sft',
adapter: 'lora',
});
// Monitor progress
const status = await client.training.get(job.id);
const metrics = await client.training.getMetrics(job.id);
// Stop / resume
await client.training.stop(job.id);
await client.training.resume(job.id);The SDK supports both API key and JWT authentication. It works in Node.js, edge runtimes, and any JavaScript environment with native fetch.
All SDK Methods
| Namespace | Method | Description |
|---|---|---|
| client | introspect() | Discover API key permissions, scopes, bound org/workspace, and allowed tools |
| models | search(params?) | Search base models by name/provider/size |
| models | getConfig(model) | Recommended GPU, methods, and hyperparameters |
| datasets | list() | List all datasets in workspace |
| datasets | upload(params) | Upload a local file (JSONL/Parquet/CSV) |
| datasets | preview(id, params?) | Preview first N rows |
| datasets | delete(id) | Delete a dataset |
| datasets | importFromHuggingFace(params) | Import from HuggingFace Hub |
| training | create(params) | Create and launch a training job |
| training | list(params?) | List all training jobs |
| training | get(id) | Get detailed job status |
| training | getMetrics(id) | Get loss curves and eval metrics |
| training | getLogs(id, params?) | Get training output logs |
| training | getCheckpoints(id) | List saved checkpoints |
| training | stop(id) | Stop a running job |
| training | resume(id) | Resume a stopped job |
| wallet | getBalance() | Wallet balance and pending charges |
| gpu | getPricing() | All GPU types with pricing |
| gpu | getRecommended(model) | Best GPU for a model+adapter |
Python SDK
For Python applications, use the usfbios package:
pip install usfbiosfrom usfbios import USFBios
client = USFBios(api_key="sk_live_...")
# Search models
models = client.models.search(query="llama 8B")
# Upload a dataset
ds = client.datasets.upload(file_path="./data.jsonl", name="My Dataset")
# Launch fine-tuning
job = client.training.create(
model="meta-llama/Llama-3.1-8B-Instruct",
dataset_id=ds.id,
method="sft",
adapter="lora",
)
# Monitor progress
metrics = client.training.get_metrics(job.id)
print(f"Loss: {metrics.current_loss}")The Python SDK mirrors the TypeScript SDK method-for-method using snake_case naming. Async support is available via AsyncUSFBios. See the full Python SDK docs in the sidebar for complete usage, type hints, and async examples.
BiOS Documentation. Need help? Email help-bios@us.inc