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

# Rerank documents

> Reranks documents based on their relevance to a query.



## OpenAPI

````yaml https://api.tokenfactory.nebius.com/openapi.json post /v1/rerank
openapi: 3.1.0
info:
  title: Nebius OpenAI-compatible inference API
  version: 20260506-297d05704
servers:
  - url: https://api.tokenfactory.nebius.com
security: []
paths:
  /v1/rerank:
    post:
      tags:
        - inference
      summary: Rerank documents
      description: Reranks documents based on their relevance to a query.
      operationId: create_rerank_v1_rerank_post
      parameters:
        - name: ai_project_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: current project ID
            title: Ai Project Id
          description: current project ID
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RerankRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RerankResponse'
              example:
                id: rerank-bbbxyuxyu643b6af
                model: Qwen/Qwen3-Reranker-8B
                usage:
                  prompt_tokens: 65
                  total_tokens: 65
                results:
                  - index: 1
                    document:
                      text: Belgrade
                    relevance_score: 0.9456538558006287
                  - index: 2
                    document:
                      text: Shrek's swamp
                    relevance_score: 0.8282327651977539
                  - index: 0
                    document:
                      text: Amsterdam
                    relevance_score: 0.16313764452934265
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    RerankRequest:
      properties:
        model:
          type: string
          title: Model
          description: ID of the model to use.
          examples:
            - Qwen/Qwen3-Reranker-8B
        query:
          type: string
          title: Query
          description: Query to rerank, encoded as a string.
          examples:
            - What is the capital of France?
        documents:
          items:
            type: string
          type: array
          title: Documents
          description: Documents to rerank, encoded as a list of strings.
          examples:
            - - The capital of Brazil is Brasilia.
              - The capital of France is Paris.
              - Amsterdam
              - Belgrade
        user:
          anyOf:
            - type: string
            - type: 'null'
          title: User
          description: A unique identifier representing your end-user.
        service_tier:
          allOf:
            - $ref: '#/components/schemas/ServiceTier'
          description: The service tier to use for the request.
          default: auto
          examples:
            - auto
            - flex
      type: object
      required:
        - model
        - query
        - documents
      title: RerankRequest
    RerankResponse:
      properties:
        id:
          type: string
          title: Id
          description: A unique identifier for the reranking response.
        model:
          type: string
          title: Model
          description: The model used for the reranking.
        usage:
          allOf:
            - $ref: '#/components/schemas/RerankUsage'
          description: Token usage stats.
        results:
          items:
            $ref: '#/components/schemas/RerankResult'
          type: array
          title: Results
          description: List of RerankResult objects
      type: object
      required:
        - id
        - model
        - usage
        - results
      title: RerankResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ServiceTier:
      type: string
      enum:
        - auto
        - default
        - over-limit
        - flex
        - no-limit
      title: ServiceTier
      description: |-
        Represents the service tier for requests.

        Attributes:
            Auto: Automatically choose the best available tier for the request (Default or OverLimit).
            Analyze response to determine which tier was used.
            Default: Return 429 errors on hitting the rate limit, do not exceed to the OverLimit tier.
            OverLimit: Indicate that the request was over the user limit.
                    This tier cannot be set by user in the request, but us used in a response for tier=Auto.
            Flex: Do not consume rate-limit credits, but run with lower priority. May still result in 429 errors
            in case of if there is no resources to process.
    RerankUsage:
      properties:
        prompt_tokens:
          type: integer
          title: Prompt Tokens
          description: Number of tokens in the prompt.
        total_tokens:
          type: integer
          title: Total Tokens
          description: Total number of tokens used in the request.
      type: object
      required:
        - prompt_tokens
        - total_tokens
      title: RerankUsage
    RerankResult:
      properties:
        index:
          type: integer
          title: Index
          description: Index of the document
        document:
          allOf:
            - $ref: '#/components/schemas/RerankDocument'
          description: Text of the document
        relevance_score:
          type: number
          title: Relevance Score
          description: Relevance score of the document
      type: object
      required:
        - index
        - document
        - relevance_score
      title: RerankResult
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    RerankDocument:
      properties:
        text:
          type: string
          title: Text
          description: Text of the document
        multi_modal:
          anyOf:
            - type: boolean
            - type: 'null'
          title: Multi Modal
          description: Whether the document is multi-modal
      type: object
      required:
        - text
      title: RerankDocument
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````