> ## Documentation Index
> Fetch the complete documentation index at: https://docs.biohub.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Protein Models API

> Run ESMC, ESMFold2, and ESM3 inference over HTTP or the esm package, with operations like fold and logits, response formats, input limits, and batch use.

The Protein Models API runs inference on ESMC, ESMFold2, and ESM3. For larger or longer-running workloads, use the [Batch API](https://docs.biohub.ai/api/protein/models/batch_overview.md).

## Install the esm package

To run `esm` locally, download the PyPI package. You can also call the API directly over HTTP without it, but the package provides a simpler way to access the API and additional useful libraries.

```bash theme={null}
pip install esm
```

To begin using the esm package, create an [API key](https://biohub.ai/developer-console/api-keys) and connect to the model you want to use:

```python theme={null}
from esm.sdk.forge import ESMCForgeInferenceClient

client = ESMCForgeInferenceClient(model="esmc-6b-2024-12", url="https://biohub.ai", token="<your API token>")
```

For ESMFold2 use `SequenceStructureForgeInferenceClient`, and for ESM3 use `ESM3ForgeInferenceClient`. See [Get started](https://docs.biohub.ai/learn/getting-started.md) for each model and [Tutorials](https://docs.biohub.ai/learn/tutorials/esmc) for code snippets that demonstrate how to use the `esm` SDK.

## Operations

| Operation | Models | Purpose |
| - | - | - |
| [fold](https://docs.biohub.ai/api/protein/models/fold.md) | ESM3, ESMFold2 | Fold proteins. Defaults to `esmfold2-fast-2026-05`. |
| [fold\_all\_atom](https://docs.biohub.ai/api/protein/models/fold_all_atom.md) | ESMFold2 | Fold molecular complexes containing proteins, DNA, RNA, and ligands. Defaults to `esmfold2-fast-2026-05`. |
| [logits](https://docs.biohub.ai/api/protein/models/logits.md) | ESM3, ESMC | Run one inference step and return logits, embeddings, and SAE features (ESMC only). |
| [encode](https://docs.biohub.ai/api/protein/models/encode.md) | ESM3, ESMC | Tokenize sequence, structure, or function annotations. |
| [decode](https://docs.biohub.ai/api/protein/models/decode.md) | ESM3, ESMC | Decode sequence, structure, or function annotation tokens. |
| [generate](https://docs.biohub.ai/api/protein/models/generate.md) | ESM3 | Generate an output track conditioned on inputs. |
| [generate\_tensor](https://docs.biohub.ai/api/protein/models/generate_tensor.md) | ESM3 | Generate an output track from raw tokens and return raw tokens. |
| [forward\_and\_sample](https://docs.biohub.ai/api/protein/models/forward_and_sample.md) | ESM3 | Run one inference step and sample output tokens. |
| [inverse\_fold](https://docs.biohub.ai/api/protein/models/inverse_fold.md) | ESM3 | Inverse fold proteins. Defaults to `esm3-open-2024-03`. |

## Example: send a request

Every operation uses the base URL `https://biohub.ai` and authenticates with your [API key](https://biohub.ai/developer-console/api-keys) in an `Authorization: Bearer` header. Send a JSON body with `Content-Type: application/json`.

First, store your API key in the `BIOHUB_API_KEY` environment variable of your terminal session. Don't paste the key into shared code or chats. Then send the request. The bash example runs in macOS and Linux terminals. On Windows, use the PowerShell example. PowerShell aliases `curl` to a different command, so the example calls `curl.exe`.

> [tab] bash
>
> ```bash theme={null}
> export BIOHUB_API_KEY="<your API key>"
>
> curl https://biohub.ai/api/v1/fold \
>   -H "Authorization: Bearer $BIOHUB_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "model": "esmfold2-fast-2026-05",
>     "sequence": "MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQ"
>   }'
> ```

> [tab] PowerShell
>
> ```powershell theme={null}
> $env:BIOHUB_API_KEY = "<your API key>"
>
> $body = @'
> {
>   "model": "esmfold2-fast-2026-05",
>   "sequence": "MKTAYIAKQRQISFVKSHFSRQLEERLGLIEVQ"
> }
> '@
>
> $body | curl.exe https://biohub.ai/api/v1/fold `
>   -H "Authorization: Bearer $env:BIOHUB_API_KEY" `
>   -H "Content-Type: application/json" `
>   --data-binary "@-"
> ```

To call another operation, such as [generate](https://docs.biohub.ai/api/protein/models/generate.md), change the path and the JSON body. See each operation's page for its request fields and response schema.

## Response formats

Responses are JSON by default. Most operations also support Python pickle responses, which can reduce payload size for tensors and arrays. The `esm` Python SDK requests pickle automatically. See [Response formats](https://docs.biohub.ai/api/protein/models/response-formats.md).

## Input limits

On `fold` and `fold_all_atom`, ESMFold2 models accept inputs up to 768 tokens. For inputs up to 4096 tokens, or to run many predictions asynchronously, use [Batch folding](https://docs.biohub.ai/api/protein/models/batch_folding.md).

## On-demand or batch

| Use | When |
| - | - |
| Protein Models API | You need a result in the same request, for interactive or low-volume work. |
| [Batch API](https://docs.biohub.ai/api/protein/models/batch_overview.md) | You have many inputs, long inputs, or long-running jobs such as maximum-accuracy folding and binder design. |


## Related topics

- [Biohub Platform API](https://docs.biohub.ai/api/overview.md)
- [Get started with ESM models](https://docs.biohub.ai/learn/getting-started.md)
- [ESM Atlas API](https://docs.biohub.ai/api/protein/atlas/overview.md)
- [fold](https://docs.biohub.ai/api/protein/models/fold.md)
- [ESMC](https://docs.biohub.ai/models/esmc.md)
