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

# Container Text Classification

> Classify text into categories using Friendli Container. Run text classification models on your own infrastructure with full data control and privacy.

Given a text input, the model classifies it into categories.


## OpenAPI

````yaml https://github.com/friendliai/friendli-openapi/raw/refs/heads/main/openapi.yaml post /classify
openapi: 3.1.0
info:
  title: Friendli Suite API Reference
  description: This is an OpenAPI reference of Friendli Suite API.
  termsOfService: https://friendli.ai/terms-of-service
  contact:
    name: FriendliAI Support Team
    email: support@friendli.ai
  version: 0.1.0
servers:
  - url: https://api.friendli.ai
security: []
tags:
  - name: Serverless.Chat
  - name: Serverless.ToolAssistedChat
  - name: Serverless.Messages
  - name: Serverless.ChatRender
  - name: Serverless.Completions
  - name: Serverless.Token
  - name: Serverless.Audio
  - name: Serverless.Model
  - name: Serverless.Knowledge
  - name: Dedicated.Chat
  - name: Dedicated.Messages
  - name: Dedicated.ChatRender
  - name: Dedicated.Completions
  - name: Dedicated.Embeddings
  - name: Dedicated.TextClassification
  - name: Dedicated.Token
  - name: Dedicated.Image
  - name: Dedicated.Audio
  - name: Dedicated.Endpoint
  - name: Container.Chat
  - name: Container.Messages
  - name: Container.Completions
  - name: Container.TextClassification
  - name: Container.Token
  - name: Container.Image
  - name: Container.Audio
  - name: Cost
  - name: Dataset
  - name: File
paths:
  /classify:
    servers:
      - url: http://localhost:8000
    post:
      tags:
        - Container.Classification
      summary: Text classification
      description: Given a text input, the model classifies it into categories.
      operationId: containerTextClassification
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ContainerTextClassificationBody'
        required: true
      responses:
        '200':
          description: Successfully classified the text input.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContainerTextClassificationSuccess'
              examples:
                Example:
                  value:
                    data:
                      - index: 0
                        label: Positive
                        num_classes: 2
                        probs:
                          - 0.9
                          - 0.1
                    object: list
                    usage:
                      prompt_tokens: 5
                      total_tokens: 5
        '422':
          description: Unprocessable Entity
components:
  schemas:
    ContainerTextClassificationBody:
      properties:
        model:
          anyOf:
            - type: string
            - type: 'null'
          title: Model
          description: Routes the request to a specific adapter.
          examples:
            - (adapter-route)
        input:
          anyOf:
            - type: string
            - items:
                type: string
              type: array
            - type: 'null'
          title: Input
          description: >-
            Input text to classify, encoded as a string or array of strings. To
            classify multiple inputs in a single request, pass an array of
            strings.


            Either `input` or `tokens` field is required.
          examples:
            - I love programming.
        tokens:
          anyOf:
            - items:
                type: integer
              type: array
            - type: 'null'
          title: Tokens
          description: |-
            The tokenized prompt (i.e., input tokens).

            Either `input` or `tokens` field is required.
          examples:
            - 72
            - 1563
            - 2335
            - 13
      type: object
      title: ContainerTextClassificationBody
      example:
        input: I love programming.
    ContainerTextClassificationSuccess:
      $ref: '#/components/schemas/TextClassificationResult'
      title: ContainerTextClassificationSuccess
    TextClassificationResult:
      properties:
        data:
          items:
            $ref: '#/components/schemas/BaseClassificationData'
          type: array
          title: Data
        object:
          type: string
          const: list
          title: Object
          description: The object type, which is always set to `list`.
        usage:
          $ref: '#/components/schemas/TextClassificationUsage'
      type: object
      required:
        - data
        - object
        - usage
      title: TextClassificationResult
    BaseClassificationData:
      properties:
        index:
          type: integer
          title: Index
          description: The index of the input in the list of inputs.
          examples:
            - 0
        label:
          type: string
          title: Label
          description: The predicted label for the input text.
          examples:
            - Positive
        num_classes:
          type: integer
          title: Num Classes
          description: The number of possible labels the model can predict.
          examples:
            - 2
        probs:
          items:
            type: number
          type: array
          title: Probs
          description: A list of logits for each possible label.
          examples:
            - - 0.1
              - 0.9
      type: object
      required:
        - index
        - label
        - num_classes
        - probs
      title: BaseClassificationData
    TextClassificationUsage:
      properties:
        prompt_tokens:
          type: integer
          title: Prompt Tokens
          description: Number of tokens in the input text.
          examples:
            - 10
        total_tokens:
          type: integer
          title: Total Tokens
          description: Total number of tokens used in the request.
          examples:
            - 10
      type: object
      required:
        - prompt_tokens
        - total_tokens
      title: TextClassificationUsage

````