# Boltzgen

BoltzGen is a general all-atom generative model that can design proteins and peptides that bind diverse biomolecular targets within a unified framework. It supports six design protocols: protein-anything, peptide-anything, protein-small-molecule, antibody-anything, nanobody-anything, and protein-redesign.

## 基础信息

| 项目 | 值 |
|------|-----|
| 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. Design proteins to bind proteins or peptides.

**Tool Name:** `design_protein_anything_design_protein_anything_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `target_file` | `file` | ✓ | Target structure (supported formats: PDB, mmCIF, required)<br/>file suffix: `pdb`, `cif` |  |
| `target_chains` | `string` | ✓ | Target chains (format: comma-separated chain IDs, e.g. 'A,B', required) |  |
| `fix_target_structure` | `boolean` | ✗ | Lock target conformation to the input structure (true, default) or let the model refold it freely (false) |  |
| `binding_site` | `string` | ✗ | Binding site (format: 'A: 13-14, 56' chain:residue-ranges, optional) |  |
| `design_length` | `string` | ✓ | Design length (format: range '80-140' or fixed length '15', required) |  |
| `bonds_info` | `string` | ✗ | Covalent bonds (format: 'R-4-SG, Q-1-CK \\n S-11-SG, S-18-SG', optional) |  |
| `secondary_structure` | `string` | ✗ | Secondary structure (format: 'loop:14 \\n helix:15..17 \\n sheet:19', optional) |  |
| `inverse_fold_avoid` | `string` | ✗ | Disallowed residues (format: amino-acid letters, e.g. 'KEC', optional) |  |
| `num_designs` | `number` | ✗ | Number of designs to generate (range: 1-1000, default: 5) |  |
| `budget` | `number` | ✗ | Final number of designs after filtering (range: 1-20, default: 1) |  |

### 示例代码

#### 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": "Boltzgen",
    "tool_name": "design_protein_anything_design_protein_anything_post",
    "parameters": {
    "target_file": "<TARGET_FILE_FILE_ID>",
    "target_chains": "<TARGET_CHAINS>",
    "fix_target_structure": false,
    "binding_site": "<BINDING_SITE>",
    "design_length": "<DESIGN_LENGTH>",
    "bonds_info": "<BONDS_INFO>",
    "secondary_structure": "<SECONDARY_STRUCTURE>",
    "inverse_fold_avoid": "<INVERSE_FOLD_AVOID>",
    "num_designs": 5,
    "budget": 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. Design (cyclic) peptides or others to bind proteins.

**Tool Name:** `design_peptide_anything_design_peptide_anything_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `target_file` | `file` | ✓ | Target structure (supported formats: PDB, mmCIF, required)<br/>file suffix: `pdb`, `cif` |  |
| `target_chains` | `string` | ✓ | Target chains (format: comma-separated chain IDs, e.g. 'A,B', required) |  |
| `fix_target_structure` | `boolean` | ✗ | Lock target conformation to the input structure (true, default) or let the model refold it freely (false) |  |
| `binding_site` | `string` | ✗ | Binding site (format: 'A: 13-14, 56' chain:residue-ranges, optional) |  |
| `design_length` | `string` | ✓ | Design length (format: range '80-140' or fixed length '15', required) |  |
| `cyclic` | `boolean` | ✗ | Whether the peptide should be cyclic (default: True) |  |
| `bonds_info` | `string` | ✗ | Covalent bonds (format: 'R-4-SG, Q-1-CK \\n S-11-SG, S-18-SG', optional) |  |
| `secondary_structure` | `string` | ✗ | Secondary structure (format: 'loop:14 \\n helix:15..17 \\n sheet:19', optional) |  |
| `inverse_fold_avoid` | `string` | ✗ | Disallowed residues (format: amino-acid letters, e.g. 'KEC', optional) |  |
| `num_designs` | `number` | ✗ | Number of designs to generate (range: 1-1000, default: 5) |  |
| `budget` | `number` | ✗ | Final number of designs after filtering (range: 1-20, default: 1) |  |

### 示例代码

#### 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": "Boltzgen",
    "tool_name": "design_peptide_anything_design_peptide_anything_post",
    "parameters": {
    "target_file": "<TARGET_FILE_FILE_ID>",
    "target_chains": "<TARGET_CHAINS>",
    "fix_target_structure": false,
    "binding_site": "<BINDING_SITE>",
    "design_length": "<DESIGN_LENGTH>",
    "cyclic": false,
    "bonds_info": "<BONDS_INFO>",
    "secondary_structure": "<SECONDARY_STRUCTURE>",
    "inverse_fold_avoid": "<INVERSE_FOLD_AVOID>",
    "num_designs": 5,
    "budget": 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.")
```


---

## 3. Design proteins to bind small molecules.

**Tool Name:** `design_protein_small_molecule_design_protein_small_molecule_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `smiles` | `string` | ✗ | SMILES strings (format: one per line, optional) |  |
| `ccd` | `string` | ✗ | CCD code(s) (format: one per line, optional) |  |
| `design_length` | `string` | ✓ | Design length (format: range '80-140' or fixed length '15', required) |  |
| `inverse_fold_avoid` | `string` | ✗ | Disallowed residues (format: amino-acid letters, e.g. 'KEC', optional) |  |
| `num_designs` | `number` | ✗ | Number of designs to generate (range: 1-1000, default: 5) |  |
| `budget` | `number` | ✗ | Final number of designs after filtering (range: 1-20, default: 1) |  |

### 示例代码

#### 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": "Boltzgen",
    "tool_name": "design_protein_small_molecule_design_protein_small_molecule_post",
    "parameters": {
    "smiles": "<SMILES>",
    "ccd": "<CCD>",
    "design_length": "<DESIGN_LENGTH>",
    "inverse_fold_avoid": "<INVERSE_FOLD_AVOID>",
    "num_designs": 5,
    "budget": 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.")
```


---

## 4. Design antibody CDRs.

**Tool Name:** `design_antibody_anything_design_antibody_anything_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `design_mode` | `select` | ✗ | Design mode (options: Default (De Novo)-preset Fab scaffolds, Custom Framework-user supplied framework, default: Default (De Novo)) | `Default (De Novo)`, `Custom Framework` |
| `Framework_file` | `file` | ✗ | Antibody framework (supported formats: PDB, mmCIF, required when design_mode is Custom Framework)<br/>file suffix: `pdb`, `cif` |  |
| `Target_file` | `file` | ✓ | Antigen structure to target (supported formats: PDB, mmCIF, required)<br/>file suffix: `pdb`, `cif` |  |
| `target_chains` | `string` | ✓ | Target antigen chains (format: comma-separated chain IDs, e.g. 'A,B', required) |  |
| `fix_target_structure` | `boolean` | ✗ | Lock target (antigen) conformation to the input structure (true, default) or let the model refold it freely (false) |  |
| `heavy_chain_CDR_Regions` | `string` | ✗ | Heavy CDR regions from Framework_file (format: 'A: 24-35, 56-68, 78-86', optional) |  |
| `heavy_chain_insertion_length_range` | `string` | ✗ | Comma-separated ranges for new residues per heavy CDR (format: '7-9,5-8,3-21', optional) |  |
| `light_chain_CDR_Regions` | `string` | ✗ | Light CDR regions from Framework_file (format: 'B: 33-38, 52-58, 82-88', optional) |  |
| `light_chain_insertion_length_range` | `string` | ✗ | Comma-separated ranges for new residues per light CDR (format: '7-9,5-8,3-21', optional) |  |
| `inverse_fold_avoid` | `string` | ✗ | Disallowed residues (format: amino-acid letters, e.g. 'KEC', optional) |  |
| `num_designs` | `number` | ✗ | Number of designs to generate (range: 1-1000, default: 5) |  |
| `budget` | `number` | ✗ | Final number of designs after filtering (range: 1-20, default: 1) |  |

### 示例代码

#### 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": "Boltzgen",
    "tool_name": "design_antibody_anything_design_antibody_anything_post",
    "parameters": {
    "design_mode": "Default (De Novo)",
    "Framework_file": "<FRAMEWORK_FILE_FILE_ID>",
    "Target_file": "<TARGET_FILE_FILE_ID>",
    "target_chains": "<TARGET_CHAINS>",
    "fix_target_structure": false,
    "heavy_chain_CDR_Regions": "<HEAVY_CHAIN_CDR_REGIONS>",
    "heavy_chain_insertion_length_range": "<HEAVY_CHAIN_INSERTION_LENGTH_RANGE>",
    "light_chain_CDR_Regions": "<LIGHT_CHAIN_CDR_REGIONS>",
    "light_chain_insertion_length_range": "<LIGHT_CHAIN_INSERTION_LENGTH_RANGE>",
    "inverse_fold_avoid": "<INVERSE_FOLD_AVOID>",
    "num_designs": 5,
    "budget": 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.")
```


---

## 5. Design nanobody CDRs.

**Tool Name:** `design_nanobody_anything_design_nanobody_anything_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `design_mode` | `select` | ✗ | Design mode (options: Default (De Novo)-preset nanobody scaffolds, Custom Framework-user supplied framework, default: Default (De Novo)) | `Default (De Novo)`, `Custom Framework` |
| `Framework_file` | `file` | ✗ | Antibody framework (supported formats: PDB, mmCIF, required when design_mode is Custom Framework)<br/>file suffix: `pdb`, `cif` |  |
| `Target_file` | `file` | ✓ | Antigen structure to target (supported formats: PDB, mmCIF, required)<br/>file suffix: `pdb`, `cif` |  |
| `target_chains` | `string` | ✓ | Target antigen chains (format: comma-separated chain IDs, e.g. 'A,B', required) |  |
| `fix_target_structure` | `boolean` | ✗ | Lock target (antigen) conformation to the input structure (true, default) or let the model refold it freely (false) |  |
| `heavy_chain_CDR_Regions` | `string` | ✗ | Heavy CDR regions from Framework_file (format: 'A: 26-34,52-59,98-118', optional) |  |
| `heavy_chain_insertion_length_range` | `string` | ✗ | Comma-separated ranges for new residues per heavy CDR (format: '1-5,1-5,1-14', optional) |  |
| `heavy_chain_anchor_regions` | `string` | ✗ | Comma-separated residue index ranges within each heavy CDR to retain as structural anchors (format: '29-34,55-59,105-118', optional) |  |
| `inverse_fold_avoid` | `string` | ✗ | Disallowed residues (format: amino-acid letters, e.g. 'KEC', optional) |  |
| `num_designs` | `number` | ✗ | Number of designs to generate (range: 1-1000, default: 5) |  |
| `budget` | `number` | ✗ | Final number of designs after filtering (range: 1-20, default: 1) |  |

### 示例代码

#### 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": "Boltzgen",
    "tool_name": "design_nanobody_anything_design_nanobody_anything_post",
    "parameters": {
    "design_mode": "Default (De Novo)",
    "Framework_file": "<FRAMEWORK_FILE_FILE_ID>",
    "Target_file": "<TARGET_FILE_FILE_ID>",
    "target_chains": "<TARGET_CHAINS>",
    "fix_target_structure": false,
    "heavy_chain_CDR_Regions": "<HEAVY_CHAIN_CDR_REGIONS>",
    "heavy_chain_insertion_length_range": "<HEAVY_CHAIN_INSERTION_LENGTH_RANGE>",
    "heavy_chain_anchor_regions": "<HEAVY_CHAIN_ANCHOR_REGIONS>",
    "inverse_fold_avoid": "<INVERSE_FOLD_AVOID>",
    "num_designs": 5,
    "budget": 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.")
```


---

## 6. Redesign or optimize existing proteins.

**Tool Name:** `design_protein_redesign_design_protein_redesign_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `target_file` | `file` | ✓ | Structure file to redesign (supported formats: PDB, mmCIF, required)<br/>file suffix: `pdb`, `cif` |  |
| `target_chains` | `string` | ✗ | Chains to load from the structure (format: comma-separated, e.g. 'A,B'. Uses all chains if unspecified, optional) |  |
| `design_regions` | `string` | ✓ | Residues to redesign / design_mask (format: 'A: 200-210; B: 200-210', required) |  |
| `fix_target_structure` | `boolean` | ✗ | Lock the non-designed regions to the input structure (true, default) or let the model refold everything (false) |  |
| `inverse_fold_avoid` | `string` | ✗ | Disallowed residues (format: amino-acid letters, e.g. 'KEC', optional) |  |
| `num_designs` | `number` | ✗ | Number of designs to generate (range: 1-1000, default: 5) |  |
| `budget` | `number` | ✗ | Final number of designs after filtering (range: 1-20, default: 1) |  |

### 示例代码

#### 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": "Boltzgen",
    "tool_name": "design_protein_redesign_design_protein_redesign_post",
    "parameters": {
    "target_file": "<TARGET_FILE_FILE_ID>",
    "target_chains": "<TARGET_CHAINS>",
    "design_regions": "<DESIGN_REGIONS>",
    "fix_target_structure": false,
    "inverse_fold_avoid": "<INVERSE_FOLD_AVOID>",
    "num_designs": 5,
    "budget": 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.")
```


---

## 7. Run BoltzGen from a user-supplied YAML design spec (advanced).

**Tool Name:** `design_from_yaml_design_from_yaml_post`

**Method:** `POST`

### 参数

| 参数名 | 类型 | 必需 | 说明 | 枚举值 |
|--------|------|------|------|--------|
| `protocol` | `select` | ✗ | Boltzgen protocol, must match the YAML content (options: protein-anything, peptide-anything, protein-small_molecule, antibody-anything, nanobody-anything, protein-redesign, default: protein-anything) | `protein-anything`, `peptide-anything`, `protein-small_molecule`, `antibody-anything`, `nanobody-anything`, `protein-redesign` |
| `design_yaml` | `file` | ✓ | BoltzGen YAML design specification file (supported formats: YAML, YML, required)<br/>file suffix: `yaml`, `yml` |  |
| `extra_files` | `file_array` | ✗ | Optional extra structure files (supported formats: PDB, mmCIF) referenced by the YAML via relative path<br/>file suffix: `pdb`, `cif` |  |
| `inverse_fold_avoid` | `string` | ✗ | Disallowed residues (format: amino-acid letters, e.g. 'KEC', optional) |  |
| `num_designs` | `number` | ✗ | Number of designs to generate (range: 1-1000, default: 5) |  |
| `budget` | `number` | ✗ | Final number of designs after filtering (range: 1-20, default: 1) |  |

### 示例代码

#### 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": "Boltzgen",
    "tool_name": "design_from_yaml_design_from_yaml_post",
    "parameters": {
    "protocol": "<PROTOCOL>",
    "design_yaml": "<DESIGN_YAML_FILE_ID>",
    "extra_files": [
        "<FILE_ID1>",
        "<FILE_ID2>"
    ],
    "inverse_fold_avoid": "<INVERSE_FOLD_AVOID>",
    "num_designs": 5,
    "budget": 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/Boltzgen>
