> ## 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.

# logits

> (ESM3, ESMC) Performs one inference step and returns logits, embeddings, and SAE features (ESMC only).



## OpenAPI

````yaml openapi/biohub-platform-openapi.json POST /api/v1/logits
openapi: 3.1.0
info:
  title: Biohub Platform API
  version: 1.0.0
servers:
  - url: https://biohub.ai
security: []
paths:
  /api/v1/logits:
    post:
      tags:
        - v1
      summary: >-
        (ESM3, ESMC) Performs one inference step and returns logits, embeddings,
        and SAE features (ESMC only).
      operationId: logits_api_v1_logits_post
      parameters:
        - name: return-bytes
          in: header
          required: false
          schema:
            type: string
            default: 'false'
            title: Return-Bytes
        - name: accept
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Accept
      requestBody:
        required: true
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/LogitsRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogitsResponse'
            application/vnd.evolutionaryscale.pickle:
              schema:
                type: string
                format: binary
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    LogitsRequest:
      properties:
        model:
          type: string
          enum:
            - esm3-open-2024-03
            - esmc-300m-2024-12
            - esmc-600m-2024-12
            - esmc-6b-2024-12
          description: >-
            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:
          type: boolean
          description: >-
            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.
          default: false
        inputs:
          $ref: '#/components/schemas/Tokens'
        logits_config:
          $ref: '#/components/schemas/LogitsConfig'
      type: object
      required:
        - model
        - inputs
        - logits_config
    LogitsResponse:
      properties:
        model:
          type: string
          enum:
            - esm3-open-2024-03
            - esmc-300m-2024-12
            - esmc-600m-2024-12
            - esmc-6b-2024-12
          description: >-
            You may have access to additional, private models as well. These
            will be visible on the Rate Limits page under the Developer Console
        created:
          type: string
          description: ISO formatted date time
        potential_sequence_of_concern:
          type: boolean
          description: Indicate that the returned sequence may be of potential concerns.
          default: false
        warning_messages:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          description: Warning messages returned by FastAPI.
        logits:
          anyOf:
            - type: string
            - $ref: '#/components/schemas/Logits'
            - type: 'null'
        embeddings:
          anyOf:
            - type: string
            - items: {}
              type: array
            - type: 'null'
        mean_embedding:
          anyOf:
            - items: {}
              type: array
            - type: 'null'
        hidden_states:
          anyOf:
            - type: string
            - items: {}
              type: array
            - type: 'null'
        mean_hidden_state:
          anyOf:
            - items: {}
              type: array
            - type: 'null'
        sae_outputs:
          anyOf:
            - type: string
            - additionalProperties: true
              type: object
            - type: 'null'
      type: object
      required:
        - model
        - created
        - tokens_used
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
      type: object
    Tokens:
      properties:
        sequence:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          description: Sequence as a list of tokens as integers.
        coordinates:
          anyOf:
            - items:
                items:
                  items:
                    anyOf:
                      - type: number
                      - type: 'null'
                  type: array
                type: array
              type: array
            - type: 'null'
          description: Coordinates of the N, CA, C atom sequence as a Nx37x3 array.
        structure:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          description: Structure output from the model as a list of integer tokens.
        secondary_structure:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          description: Secondary structure in 8-class DSSP format.
        sasa:
          anyOf:
            - items:
                anyOf:
                  - type: integer
                  - type: 'null'
              type: array
            - type: 'null'
          description: Solvent accessible surface area (SASA) as a list of integers.
        function:
          anyOf:
            - items:
                items:
                  type: integer
                type: array
              type: array
            - type: 'null'
          description: Function annotations, as a list of integers.
        residue_annotation:
          anyOf:
            - items:
                items:
                  type: integer
                type: array
              type: array
            - type: 'null'
          description: Residue annotations tokens, as a list of integers.
      type: object
    LogitsConfig:
      properties:
        sequence:
          type: boolean
          description: (ESM3, ESMC) Return sequence logits.
          default: false
        structure:
          type: boolean
          description: (not supported on Forge/Biohub Platform) Return structure logits.
          default: false
        secondary_structure:
          type: boolean
          description: >-
            (not supported on Forge/Biohub Platform) Return secondary structure
            logits.
          default: false
        sasa:
          type: boolean
          description: (not supported on Forge/Biohub Platform) Return sasa logits.
          default: false
        function:
          type: boolean
          description: (not supported on Forge/Biohub Platform) Return function logits.
          default: false
        residue_annotations:
          type: boolean
          description: (ESM3) Return residue annotations logits.
          default: false
        return_embeddings:
          type: boolean
          description: (ESM3, ESMC) Whether embeddings should be returned.
          default: false
        return_mean_embedding:
          type: boolean
          description: (ESM3, ESMC) Whether mean embeddings should be returned.
          default: false
        return_hidden_states:
          type: boolean
          description: >-
            (ESMC, ESM3 except Large) Whether to return per-residue hidden
            states. With ith_hidden_layer=-1, returns all layers as a tensor of
            shape [n_layers + 1, B, L, D]. With ith_hidden_layer!= -1, returns
            the selected layer as a tensor of shape [1, B, L, D]. ESM3 requires
            ith_hidden_layer to be specified.
          default: false
        return_mean_hidden_states:
          type: boolean
          description: >-
            (ESMC, ESM3 except Large) Whether hidden states mean-pooled along
            the sequence length (L) dimension should be returned. Returns a
            tensor of shape [B, n_layers + 1, D].
          default: false
        ith_hidden_layer:
          type: integer
          description: >
            (ESM3, ESMC) Valid values are 0 to max_ith_hidden_layer (inclusive),
            where index 0 is the embedding layer. -1 returns all layers, but is
            not supported for ESMC 6B or any ESM3 model.

            | Model Name                    | max_ith_hidden_layer           |

            |-------------------------------|--------------------------------|

            | esmc-300-2024-12              | 30                             |

            | esmc-600-2024-12              | 36                             |

            | esmc-6b-2024-12               | 80                             |

            | esm3-small-2024-03            | 48                             |

            | esm3-small-2024-08            | 48                             |

            | esm3-medium-2024-03           | 96                             |

            | esm3-medium-2024-08           | 96                             |
          default: -1
        sae_config:
          anyOf:
            - $ref: '#/components/schemas/SAEConfig'
            - type: 'null'
          description: (ESMC) SAE config for requesting sparse autoencoder features.
      type: object
    Logits:
      properties:
        sequence:
          anyOf:
            - items:
                items:
                  type: number
                type: array
              type: array
            - type: 'null'
          description: Sequence track logits.
        structure:
          anyOf:
            - items:
                items:
                  type: number
                type: array
              type: array
            - type: 'null'
          description: Structure track logits.
        secondary_structure:
          anyOf:
            - items:
                items:
                  type: number
                type: array
              type: array
            - type: 'null'
          description: Secondary structure track logits.
        sasa:
          anyOf:
            - items:
                anyOf:
                  - items:
                      type: number
                    type: array
                  - type: 'null'
              type: array
            - type: 'null'
          description: Solvent accessible surface area (SASA) track logits.
        function:
          anyOf:
            - items:
                items:
                  items:
                    type: number
                  type: array
                type: array
              type: array
            - type: 'null'
          description: Function annotations logits.
        residue_annotation:
          anyOf:
            - items:
                items:
                  type: number
                type: array
              type: array
            - type: 'null'
          description: Residue annotations logits.
      type: object
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
        msg:
          type: string
        type:
          type: string
        input: {}
        ctx:
          type: object
      type: object
      required:
        - loc
        - msg
        - type
    SAEConfig:
      properties:
        models:
          items:
            type: string
            enum:
              - esmc-300m-2024-12-sae-layer23-k64-codebook65536
              - esmc-600m-2024-12-sae-layer27-k64-codebook16384
              - esmc-600m-2024-12-sae-layer27-k64-codebook65536
              - esmc-6b-2024-12-sae-layer60-k64-codebook16384
              - esmc-6b-2024-12-sae-layer60-k64-codebook65536
          type: array
          description: List of SAE models with specific layer and codebook size.
        normalize_features:
          type: boolean
          description: Normalize computed features before return. Default to True.
          default: true
      type: object
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````