Free 2k Requests / mo.
Predict structure using Meta's SOTA language model.
Create viable sequences from the suite of models.
Mature molecules like antibodies and enzymes.
Learn how to use our AI tools.
Try out different models & apps.
Get started with BioLM
View our library of models
Learn more about the API
Use the Python SDK
Finetune models yourself
ProGen2 OAS API ProGen2 Medium API ProGen2 BFD90 API
Learn how to quickly access the ProGen2 models using REST APIs, for rapid and semi-directed protein generation.
ProGen2, with models up to 6.4B parameters, is adept at generating viable protein sequences and predicting their fitness. It's utilized in protein design, trained on data from genomic and metagenomic sources.
In order to use the BioLM API, you need to have a token. You can get one from the User API Tokens page.
Paste the API token you generated in the cell below, as the value of the variable BIOLMAI_TOKEN.
BIOLMAI_TOKEN
BIOLMAI_TOKEN = " " # !!! YOUR API TOKEN HERE !!!
We need to make sure we have the Python requests module loaded first.
requests
try: # Install packages to make API requests in JLite import micropip await micropip.install('requests') await micropip.install('pyodide-http') # Patch requests for in-browser support import pyodide_http pyodide_http.patch_all() except ModuleNotFoundError: pass # Won't be using micropip outside of JLite import requests from IPython.display import JSON # Helpful UI for JSON display
SLUG = 'progen2-medium' ACTION = 'generate' url = f"https://biolm.ai/api/v2/{SLUG}/{ACTION}/" headers = { "Content-Type": "application/json", "Authorization": f"Token {BIOLMAI_TOKEN.strip()}", } data = { "params": { "temperature": 0.1, # Temperature "top_p": 0.6, # Nucleus sampling probability "num_samples": 2, # Number of proteins to generate "max_length": 175 # Max length of generated proteins }, "items": [ { "context": "MA" # Starting amino acid(s) for protein } ] } # Make the request response = requests.post( url=url, headers=headers, json=data, ) result = response.json() result
{'results': [[{'sequence': 'MASSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS', 'll_sum': -24.980167388916016, 'll_mean': -0.14356417953968048}, {'sequence': 'MASSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS', 'll_sum': -24.980167388916016, 'll_mean': -0.14356417953968048}]]}
We can view this a bit more easily below:
JSON(result)
<IPython.core.display.JSON object>
import requests SLUG = 'progen2-oas' ACTION = 'generate' url = f"https://biolm.ai/api/v2/{SLUG}/{ACTION}/" headers = { "Content-Type": "application/json", "Authorization": f"Token {BIOLMAI_TOKEN.strip()}", } data = { "params": { "temperature": 0.7, # Temperature "top_p": 0.6, # Nucleus sampling probability "num_samples": 2, # Number of proteins to generate "max_length": 175 # Max length of generated proteins }, "items": [ { "context": "EVQ" # Starting amino acids for Antibody } ] } # Make the POST request response = requests.post( url=url, headers=headers, json=data, ) result = response.json() result
{'results': [[{'sequence': 'EVQLVESGGGLVQPGGSLRLSCAASGFTFSSYWMSWVRQAPGKGLEWVANIKQDGSEKYYVDSVKGRFTISRDNAKNSLYLQMNSLRAEDTAVYYCARDRYYDFWSGYYTGYYYYYMDVWGKGTTVTVSS', 'll_sum': -24.10324001312256, 'll_mean': -0.1854095384478569}, {'sequence': 'EVQLVESGGGLVQPGGSLRLSCAASGFTFSSYSMNWVRQAPGKGLEWVSYISSSSSTIYYADSVKGRFTISRDNAKNSLYLQMNSLRAEDTAVYYCARDRSSSWYGGGYYYYGMDVWGQGTTVTVSS', 'll_sum': -26.63103485107422, 'll_mean': -0.20969318598508835}]]}
import requests SLUG = 'progen2-bfd90' ACTION = 'generate' url = f"https://biolm.ai/api/v2/{SLUG}/{ACTION}/" headers = { "Content-Type": "application/json", "Authorization": f"Token {BIOLMAI_TOKEN.strip()}", } data = { "params": { "temperature": 0.7, # Temperature "top_p": 0.6, # Nucleus sampling probability "num_samples": 2, # Number of proteins to generate "max_length": 175 # Max length of generated proteins }, "items": [ { "context": "M" # Starting amino acid(s) for protein } ] } # Make the request response = requests.post( url=url, headers=headers, json=data, ) result = response.json() result
{'results': [[{'sequence': 'MASGASAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPAAAAAAAAAAAA', 'll_sum': -84.33449363708496, 'll_mean': -0.48468099534511566}, {'sequence': 'MADDEEYEEVVEYYTEETVYEEVPGETITEIYETTTTRTSDYEQSETSKPALAQPVPAKPVERKKVIRKKVDSSKFMTPYIEHSQKMQDLFSTNKYKENYEKAKGQPYAITTDTPELRRIKKVQDQLSEVKYRMDGDVAKTICHVDEKAKDIEHAKKVSQQVSKVLYKQNWEDT', 'll_sum': -114.54681396484375, 'll_mean': -0.6583150252699852}]]}
Check out additional tutorials at jupyter.biolm.ai, or head over to our BioLM Documentation to explore additional models and functionality.