---
title: "(ESM3) Performs one inference step and samples output tokens"
method: POST
path: "/api/v1/forward_and_sample"
tags: ["v1"]
---

# (ESM3) Performs one inference step and samples output tokens

`POST /api/v1/forward_and_sample`

## Headers

- `accept` string, nullable

## Request body

- ForwardAndSampleRequest
  - `model` 'esm3-open-2024-03', required — You may have access to additional, private models as well. These will be visible on the Rate Limits page under the Developer Console
  - `potential_sequence_of_concern` boolean — Disclose potential sequences of concern. For approved users, such sequences will not go through additional safety filtering. Reach out if you are interested in using this.
  - `inputs` Tokens, required
    - `sequence` integer[], nullable — Sequence as a list of tokens as integers.
    - `coordinates` array[], nullable — Coordinates of the N, CA, C atom sequence as a Nx37x3 array.
      - array[]
        - number[]
    - `structure` integer[], nullable — Structure output from the model as a list of integer tokens.
    - `secondary_structure` integer[], nullable — Secondary structure in 8-class DSSP format.
    - `sasa` integer[], nullable — Solvent accessible surface area (SASA) as a list of integers.
    - `function` array[], nullable — Function annotations, as a list of integers.
      - integer[]
    - `residue_annotation` array[], nullable — Residue annotations tokens, as a list of integers.
      - integer[]
  - `sampling_config` SamplingConfig, required
    - `sequence` PerTrackSamplingConfig
      - `temperature` number — Temperature for sampling.
      - `top_p` number — Sample from logits within the top-p probability.
      - `only_sample_masked_tokens` boolean — Only sample for masked tokens.
      - `invalid_ids` integer[] — Token indices that should not be sampled.
      - `topk_logprobs` integer — Number of top ranking prediction and logprobs to return.
    - `structure` PerTrackSamplingConfig
      - `temperature` number — Temperature for sampling.
      - `top_p` number — Sample from logits within the top-p probability.
      - `only_sample_masked_tokens` boolean — Only sample for masked tokens.
      - `invalid_ids` integer[] — Token indices that should not be sampled.
      - `topk_logprobs` integer — Number of top ranking prediction and logprobs to return.
    - `secondary_structure` PerTrackSamplingConfig
      - `temperature` number — Temperature for sampling.
      - `top_p` number — Sample from logits within the top-p probability.
      - `only_sample_masked_tokens` boolean — Only sample for masked tokens.
      - `invalid_ids` integer[] — Token indices that should not be sampled.
      - `topk_logprobs` integer — Number of top ranking prediction and logprobs to return.
    - `sasa` PerTrackSamplingConfig
      - `temperature` number — Temperature for sampling.
      - `top_p` number — Sample from logits within the top-p probability.
      - `only_sample_masked_tokens` boolean — Only sample for masked tokens.
      - `invalid_ids` integer[] — Token indices that should not be sampled.
      - `topk_logprobs` integer — Number of top ranking prediction and logprobs to return.
    - `function` PerTrackSamplingConfig
      - `temperature` number — Temperature for sampling.
      - `top_p` number — Sample from logits within the top-p probability.
      - `only_sample_masked_tokens` boolean — Only sample for masked tokens.
      - `invalid_ids` integer[] — Token indices that should not be sampled.
      - `topk_logprobs` integer — Number of top ranking prediction and logprobs to return.
  - `embedding_config` EmbeddingConfig
    - `sequence` boolean — Whether to return the embedding mean-pooled over the sequence length.
    - `per_residue` boolean — Whether to return per-residue embeddings.

## Response `200`

Successful Response

- ForwardAndSampleResponse
  - `model` 'esm3-open-2024-03', required — You may have access to additional, private models as well. These will be visible on the Rate Limits page under the Developer Console
  - `created` string, required — ISO formatted date time
  - `potential_sequence_of_concern` boolean — Indicate that the returned sequence may be of potential concerns.
  - `warning_messages` string[], nullable — Warning messages returned by FastAPI.
  - `sequence` SamplingOutput
    - `tokens` union, required — Sampled tokens.
      - integer[]
      - array[]
        - integer[]
      - number[]
    - `logprobs` union — Log probabilities that were sampled from.
      - number[]
      - array[]
        - number[]
    - `entropy` number[], nullable — Entropies of different tokens.
    - `topk_logprobs` union — Log probabilities of topk tokens if option is turned on
      - array[]
        - number[]
      - array[]
        - array[]
          - number[]
    - `topk_tokens` array[], nullable — Topk most likely tokens if option is turned on
      - number[]
  - `structure` SamplingOutput
    - `tokens` union, required — Sampled tokens.
      - integer[]
      - array[]
        - integer[]
      - number[]
    - `logprobs` union — Log probabilities that were sampled from.
      - number[]
      - array[]
        - number[]
    - `entropy` number[], nullable — Entropies of different tokens.
    - `topk_logprobs` union — Log probabilities of topk tokens if option is turned on
      - array[]
        - number[]
      - array[]
        - array[]
          - number[]
    - `topk_tokens` array[], nullable — Topk most likely tokens if option is turned on
      - number[]
  - `secondary_structure` SamplingOutput
    - `tokens` union, required — Sampled tokens.
      - integer[]
      - array[]
        - integer[]
      - number[]
    - `logprobs` union — Log probabilities that were sampled from.
      - number[]
      - array[]
        - number[]
    - `entropy` number[], nullable — Entropies of different tokens.
    - `topk_logprobs` union — Log probabilities of topk tokens if option is turned on
      - array[]
        - number[]
      - array[]
        - array[]
          - number[]
    - `topk_tokens` array[], nullable — Topk most likely tokens if option is turned on
      - number[]
  - `sasa` SamplingOutput
    - `tokens` union, required — Sampled tokens.
      - integer[]
      - array[]
        - integer[]
      - number[]
    - `logprobs` union — Log probabilities that were sampled from.
      - number[]
      - array[]
        - number[]
    - `entropy` number[], nullable — Entropies of different tokens.
    - `topk_logprobs` union — Log probabilities of topk tokens if option is turned on
      - array[]
        - number[]
      - array[]
        - array[]
          - number[]
    - `topk_tokens` array[], nullable — Topk most likely tokens if option is turned on
      - number[]
  - `function` SamplingOutput
    - `tokens` union, required — Sampled tokens.
      - integer[]
      - array[]
        - integer[]
      - number[]
    - `logprobs` union — Log probabilities that were sampled from.
      - number[]
      - array[]
        - number[]
    - `entropy` number[], nullable — Entropies of different tokens.
    - `topk_logprobs` union — Log probabilities of topk tokens if option is turned on
      - array[]
        - number[]
      - array[]
        - array[]
          - number[]
    - `topk_tokens` array[], nullable — Topk most likely tokens if option is turned on
      - number[]
  - `residue_annotation` SamplingOutput
    - `tokens` union, required — Sampled tokens.
      - integer[]
      - array[]
        - integer[]
      - number[]
    - `logprobs` union — Log probabilities that were sampled from.
      - number[]
      - array[]
        - number[]
    - `entropy` number[], nullable — Entropies of different tokens.
    - `topk_logprobs` union — Log probabilities of topk tokens if option is turned on
      - array[]
        - number[]
      - array[]
        - array[]
          - number[]
    - `topk_tokens` array[], nullable — Topk most likely tokens if option is turned on
      - number[]
  - `embeddings` Embeddings, required
    - `sequence` unknown[], nullable — Sequence embedding.
      - unknown
    - `per_residue` unknown[], nullable — Per residue embedding.
      - unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/evolutionaryscale/apis/untitled-api.md) · [All operations](https://skmtc.net/evolutionaryscale/apis/untitled-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/evolutionaryscale/untitled-api/revisions/f1cfb00607df/schema)
