Skip to main content
Protein model APIs return JSON by default. Supported endpoints also offer opt-in Python pickle responses, which can reduce payload size for tensors and arrays. The esm Python SDK requests pickle automatically on these endpoints and decodes the response for you.

Supported endpoints

JSON and pickle responses are available for: fold_all_atom uses dedicated compact serialization for its molecular-complex payload and does not negotiate pickle responses.

Choose a format for direct API calls

Keep the request body as JSON with Content-Type: application/json for either response format. Use the Accept header to select the response format.

JSON

Request JSON when you need a language-independent response:
The response has Content-Type: application/json. Array values are represented as JSON arrays. Omitting Accept also returns JSON.

Pickle

Request pickle with a JSON fallback:
A pickle response has Content-Type: application/vnd.evolutionaryscale.pickle and contains a pickled response dictionary. Array fields can retain PyTorch tensors or NumPy arrays instead of being converted to lists. Read the response’s Content-Type before decoding it; the Python SDK handles this automatically.

HTTP compression

Pickle determines how response data is serialized. HTTP gzip compression reduces the size of those serialized bytes and is supported for both JSON and pickle. To allow gzip responses, send:
Use the response’s Content-Encoding header to determine whether decompression is needed. The Python SDK’s HTTP clients handle decompression automatically. Payload savings depend on the data. Large coordinate or embedding arrays benefit from binary representation, while pickle’s object metadata can make small responses larger than JSON.