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

# Rerank documents

> Rank documents by relevance to a query (Jina-style / OpenAI-compatible rerank).



## OpenAPI

````yaml openapi/xgapi-public.yaml POST /v1/rerank
openapi: 3.0.3
info:
  title: Omniall AI Public API
  description: >-
    Omniall AI public API. Website: https://omniall.ai — API host:
    https://api.omniall.ai — Model Square: https://omniall.ai/pricing
  version: 1.1.0
servers:
  - url: https://api.omniall.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Models
    description: List models available to your API key.
  - name: ChatGPT Chat Completions
    x-group: ChatGPT
    description: OpenAI Chat Completions (`POST /v1/chat/completions`).
  - name: Responses
    description: OpenAI Responses API (`POST /v1/responses`).
  - name: Claude
    description: Anthropic Messages API (`POST /v1/messages`).
  - name: Gemini
    description: Google Gemini generateContent / streamGenerateContent.
  - name: Images
    description: >-
      Image generation (OpenAI Images), vendor guides, and Midjourney proxy
      APIs.
  - name: Video
    description: Async video tasks.
  - name: Audio
    description: Speech and related audio APIs.
  - name: Rerank
    description: Document reranking.
paths:
  /v1/rerank:
    post:
      tags:
        - Rerank
      summary: Rerank documents
      description: >-
        Rank documents by relevance to a query (Jina-style / OpenAI-compatible
        rerank).
      operationId: createRerank
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RerankRequest'
            example:
              model: rerank-english-v2.0
              query: What is Omniall AI?
              documents:
                - Omniall is an AI API gateway.
                - Cats are animals.
                - Rerank scores relevance.
              top_n: 2
              return_documents: true
      responses:
        '200':
          description: Rerank results
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RerankResponse'
              example:
                id: rerank-...
                results:
                  - index: 0
                    relevance_score: 0.91
                    document:
                      text: Omniall is an AI API gateway.
                  - index: 2
                    relevance_score: 0.72
                    document:
                      text: Rerank scores relevance.
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIErrorResponse'
components:
  schemas:
    RerankRequest:
      type: object
      required:
        - model
        - query
        - documents
      properties:
        model:
          type: string
          example: rerank-english-v2.0
          description: Rerank model id.
        query:
          type: string
          description: The search/query text used to score documents.
        documents:
          type: array
          description: >-
            Documents to rank. Each item can be a plain string or an object,
            depending on the model.
          items:
            oneOf:
              - type: string
              - type: object
                additionalProperties: true
        top_n:
          type: integer
          description: Return only the top N results (optional).
        return_documents:
          type: boolean
          default: false
          description: If true, include document text/objects in the response results.
      description: Rerank documents by relevance to a query.
    RerankResponse:
      type: object
      properties:
        id:
          type: string
          description: Request/result id.
        results:
          type: array
          items:
            type: object
            properties:
              index:
                type: integer
                description: Index of the document in the original `documents` array.
              relevance_score:
                type: number
                description: Higher means more relevant to `query`.
              document:
                type: object
                additionalProperties: true
                description: Document payload when `return_documents` is true.
            description: One ranked document.
          description: Ranked hits.
        meta:
          type: object
          additionalProperties: true
          description: Optional provider metadata.
      description: Rerank results, sorted by relevance.
    OpenAIErrorResponse:
      type: object
      description: OpenAI-style error envelope returned on auth/request failures.
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
            - type
          properties:
            message:
              type: string
              description: >-
                Human-readable error. The gateway may append a request id for
                support.
            type:
              type: string
              description: Error type, commonly `new_api_error`.
              example: new_api_error
            code:
              type: string
              description: >-
                Optional machine-readable code (e.g. `access_denied`). May be an
                empty string.
          description: Error object.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 'Use Authorization: Bearer sk-... from https://omniall.ai/dashboard'

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.