# Boltz-2

Boltz-2 is a new biomolecular foundation model that goes beyond AlphaFold3 and Boltz-1 by jointly modeling complex structures and binding affinities, a critical component towards accurate molecular design. Boltz-2 is the first deep learning model to approach the accuracy of physics-based free-energy perturbation (FEP) methods, while running 1000x faster — making accurate in silico screening practical for early-stage drug discovery.

## 基础信息

| 项目 | 值 |
|------|-----|
| Base URL | `https://sciminer.tech/console/api` |
| API Endpoint | `/v1/internal/tools/invoke` |
| Content-Type | `application/json` |
| Authentication | `X-Auth-Token: <YOUR_API_KEY>` |

## 1. Get Boltz Info From Params2

**Tool Name:** `get_boltz_info_from_params2_get_boltz_info_from_params2_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `protein_MSA_method` | `select` | ✗ | MSA strategy for protein chains (Default Search / Upload File / No MSA). | `Default Search`, `Upload File`, `No MSA` |
| `protein` | `array` | ✗ | Protein amino-acid sequences, one per chain. Chains are auto-numbered P1, P2, ... in input order; other parameters reference them by these IDs. |  |
| `protein_MSA_file` | `file` | ✗ | A3M multiple-sequence-alignment file, required when method == 'Upload File'.<br/>file suffix: `a3m` |  |
| `rna` | `array` | ✗ | RNA sequences, one per chain; chains are auto-numbered R1, R2, ... in input order. |  |
| `dna` | `array` | ✗ | DNA sequences, one per chain; chains are auto-numbered D1, D2, ... in input order. |  |
| `modifications` | `array` | ✗ | Residue modifications as '<ChainID>-<CCD>-<Position>', e.g. 'P1-SEP-15' = phosphoserine at residue 15 of chain P1. Multiple entries allowed. |  |
| `ligand_smiles` | `array` | ✗ | Ligand SMILES strings, one per ligand; ligands are numbered L1, L2, ... in input order. Ketcher plugin payloads ('.sdf()' / '.select()') supported. |  |
| `ligand_ccd` | `array` | ✗ | Ligand CCD codes (e.g. 'ATP'), one per ligand; L<n> numbering continues after any SMILES ligands. |  |
| `covalent_bonds` | `array` | ✗ | Covalent bonds as 'ChainA-ResIdx-AtomName-ChainB-ResIdx-AtomName', e.g. 'P1-13-SG-L1-1-C1'. For a ligand partner: residue index 1, atom = the Ketcher-selected atom. |  |
| `pocket_restraints` | `array` | ✗ | Pocket restraints as 'BinderChainID-ContactsChainID-ResIdx', e.g. 'L1-P1-387'. Single binder chain only; multiple entries allowed. |  |
| `contact_restraints` | `array` | ✗ | Contact restraints as 'ChainA-ResIdx-ChainB-ResIdx-max_distance', e.g. 'P1-387-P2-101-5.5' (distance in Angstroms). |  |
| `template_file` | `file_array` | ✗ | Template CIF files (protein chains only), numbered temp1, temp2, ... in upload order for template_info.<br/>file suffix: `cif` |  |
| `template_info` | `array` | ✗ | Template mapping '<temp_id>-<chain_ids>-<template_chain_ids>', e.g. 'temp1-P1,P2-A,B'. temp_id 'temp<n>' = n-th uploaded template_file; the two chain lists map one-to-one, or use 'Auto' to match automatically. |  |
| `affinity_binder` | `string` | ✗ | Binder chain ID for affinity prediction (e.g. 'L1').  If binding affinity calculation is required, please ensure that the input small-molecule ligands are unique.‌ |  |
| `use_potentials` | `boolean` | ✗ | Whether to apply Boltz inference-time potentials (--use_potentials) to improve the physical plausibility of the predicted poses. |  |
| `diffusion_samples` | `number` | ✗ | Number of diffusion samples (structural predictions) to generate, 1-30. |  |

### 示例代码

#### Python

```python
import requests

BASE_URL = "https://sciminer.tech/console/api"
API_KEY = "<YOUR_API_KEY>"
endpoint = "/v1/internal/tools/invoke"

# If the invoked API includes FILE-type parameters, upload the file first to obtain a `file_id`,
# then fill the corresponding field in `parameters` with the returned `file_id`.
# File upload example (form-data, parameter name is `file`):

# files = {'file': open('path/to/your_file.ext', 'rb')}
# upload_url = f"{BASE_URL}/v1/internal/tools/file"
# resp_upload = requests.post(upload_url, files=files, headers={"X-Auth-Token": f"{API_KEY}"}, timeout=60)
# resp_upload.raise_for_status()
# file_id = resp_upload.json().get("file_id")
# print(f"File uploaded successfully, file_id: {file_id}")
# # Then set the `file_id` in the corresponding field of `payload['parameters']`, for example: payload['parameters']["your_file_param_name"] = file_id

headers = {
    "X-Auth-Token": f"{API_KEY}",
    "Content-Type": "application/json",
}

payload = {
    "provider_name": "Boltz-2",
    "tool_name": "get_boltz_info_from_params2_get_boltz_info_from_params2_post",
    "parameters": {
    "protein_MSA_method": "<PROTEIN_MSA_METHOD>",
    "protein": [],
    "protein_MSA_file": "<PROTEIN_MSA_FILE_FILE_ID>",
    "rna": [],
    "dna": [],
    "modifications": [],
    "ligand_smiles": [],
    "ligand_ccd": [],
    "covalent_bonds": [],
    "pocket_restraints": [],
    "contact_restraints": [],
    "template_file": [
        "<FILE_ID1>",
        "<FILE_ID2>"
    ],
    "template_info": [],
    "affinity_binder": "<AFFINITY_BINDER>",
    "use_potentials": false,
    "diffusion_samples": 1
},
    # The job name is an optional parameter.
    #"job_name": "xxx",
}

# Step 1: Submit the task.
# Call the /invoke endpoint to start the task and obtain a task_id.
print("1. Submitting task...")
resp_submit = requests.post(f"{BASE_URL}{endpoint}", json=payload, headers=headers, timeout=30)
resp_submit.raise_for_status()
task_id = resp_submit.json().get("task_id")
print(f"Task ID: {task_id}")

# Step 2: Poll for the result.
# Use the task_id obtained above to call the /result endpoint to check status and fetch the result.
# If this tool takes a long time, you can increase the max_retries parameter or after exceeding the maximum number of times, you can use the task_id to re-request.
status_url = f"https://sciminer.tech/console/api/v1/internal/tools/result"
max_retries = 300
status = "PENDING"
for i in range(max_retries):
    print(f"Polling status (attempt {i+1}/{max_retries})...")
    resp_status = requests.get(
        status_url,
        params={"task_id": task_id},
        headers=headers,
        timeout=10
    )
    resp_status.raise_for_status()
    
    result = resp_status.json()
    status = result.get("status")
    print(f"Status: {status}")
    
    if status == "SUCCESS":
        print("✅ Task completed successfully！")
        print(f"Result: {result.get('result')}")
        break
    elif status == "FAILURE":
        print(f"❌ Task failed: {result.get('result')}")
        break
    else:
        # Wait 2 seconds before retrying
        import time
        time.sleep(2)
else:
    print("⏱️  Maximum retry attempts reached. The task is still running.")
```


---

## 2. Get Boltz Info From Yaml

**Tool Name:** `get_boltz_info_from_yaml_get_boltz_info_from_yaml_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `protein_MSA_method` | `select` | ✗ | MSA strategy for protein chains (Default Search / No MSA). 'Upload File' is not supported here because a separately uploaded MSA file cannot be mapped to specific chains in a user-supplied YAML. | `Default Search`, `No MSA` |
| `use_potentials` | `boolean` | ✗ | Whether to apply Boltz inference-time potentials (--use_potentials) to improve the physical plausibility of the predicted poses. |  |
| `input_files` | `file_array` | ✓ | One or more Boltz input files. Accepted formats: Boltz YAML (.yaml/.yml) or FASTA (.fasta/.fa) for protein/DNA/RNA.<br/>file suffix: `yaml`, `yml`, `fasta`, `fa` |  |
| `diffusion_samples` | `number` | ✗ | Number of diffusion samples (structural predictions) to generate, 1-30. |  |

### 示例代码

#### Python

```python
import requests

BASE_URL = "https://sciminer.tech/console/api"
API_KEY = "<YOUR_API_KEY>"
endpoint = "/v1/internal/tools/invoke"

# If the invoked API includes FILE-type parameters, upload the file first to obtain a `file_id`,
# then fill the corresponding field in `parameters` with the returned `file_id`.
# File upload example (form-data, parameter name is `file`):

# files = {'file': open('path/to/your_file.ext', 'rb')}
# upload_url = f"{BASE_URL}/v1/internal/tools/file"
# resp_upload = requests.post(upload_url, files=files, headers={"X-Auth-Token": f"{API_KEY}"}, timeout=60)
# resp_upload.raise_for_status()
# file_id = resp_upload.json().get("file_id")
# print(f"File uploaded successfully, file_id: {file_id}")
# # Then set the `file_id` in the corresponding field of `payload['parameters']`, for example: payload['parameters']["your_file_param_name"] = file_id

headers = {
    "X-Auth-Token": f"{API_KEY}",
    "Content-Type": "application/json",
}

payload = {
    "provider_name": "Boltz-2",
    "tool_name": "get_boltz_info_from_yaml_get_boltz_info_from_yaml_post",
    "parameters": {
    "protein_MSA_method": "<PROTEIN_MSA_METHOD>",
    "use_potentials": false,
    "input_files": [
        "<FILE_ID1>",
        "<FILE_ID2>"
    ],
    "diffusion_samples": 1
},
    # The job name is an optional parameter.
    #"job_name": "xxx",
}

# Step 1: Submit the task.
# Call the /invoke endpoint to start the task and obtain a task_id.
print("1. Submitting task...")
resp_submit = requests.post(f"{BASE_URL}{endpoint}", json=payload, headers=headers, timeout=30)
resp_submit.raise_for_status()
task_id = resp_submit.json().get("task_id")
print(f"Task ID: {task_id}")

# Step 2: Poll for the result.
# Use the task_id obtained above to call the /result endpoint to check status and fetch the result.
# If this tool takes a long time, you can increase the max_retries parameter or after exceeding the maximum number of times, you can use the task_id to re-request.
status_url = f"https://sciminer.tech/console/api/v1/internal/tools/result"
max_retries = 300
status = "PENDING"
for i in range(max_retries):
    print(f"Polling status (attempt {i+1}/{max_retries})...")
    resp_status = requests.get(
        status_url,
        params={"task_id": task_id},
        headers=headers,
        timeout=10
    )
    resp_status.raise_for_status()
    
    result = resp_status.json()
    status = result.get("status")
    print(f"Status: {status}")
    
    if status == "SUCCESS":
        print("✅ Task completed successfully！")
        print(f"Result: {result.get('result')}")
        break
    elif status == "FAILURE":
        print(f"❌ Task failed: {result.get('result')}")
        break
    else:
        # Wait 2 seconds before retrying
        import time
        time.sleep(2)
else:
    print("⏱️  Maximum retry attempts reached. The task is still running.")
```


---

## User Interface URL

> When the user needs a tool recommendation, output the URL.

**URL:** <https://sciminer.tech/utility/tool/Boltz-2>
