---
title: "Create Rerank"
method: POST
path: "/v1/rerank"
tags: ["Rerank"]
---

# Create Rerank

`POST /v1/rerank`

## Request body

- CreateRerankBody
  - `query` string, required — The search query to use for the reranking. `query` and `prompt` cannot both be provided.
  - `documents` string[], required
  - `model` string, required — The model to use for the reranking, call `/v1/models` endpoint to get the list of available models, only `text-classification` model type is supported.
  - `top_n` integer, nullable — The number of top results to return. If set to None, all results will be returned.

## Response `200`

Successful Response

- RerankResponse
  - `object` 'list'
  - `id` string, required — A unique identifier for the request.
  - `results` RerankResult[], required — The list of reranked texts.
    - `relevance_score` number, required — The relevance score of the reranked text.
    - `index` integer, required — The index of the reranked text.
  - `model` string, required — The model used to generate the reranking.
  - `usage` ApiDomainUsageEntitiesUsage
    - `prompt_tokens` integer
    - `completion_tokens` integer
    - `total_tokens` integer
    - `cost` number
    - `impacts` ApiDomainUsageEntitiesEnvironmentalImpacts
      - `kWh` number
      - `kgCO2eq` number

## Other responses

- `400` — Insufficient budget.
- `401` — Invalid authentication scheme.<br>Invalid API key.
- `403` — Your account has expired. Please contact support to renew your account.
- `404` — Model {name} not found.
- `422` — Model has wrong type. Expected: {expected_type}. Actual: {actual_type}.
- `429` — Token/request limit per minute/day exceeded.
- `503` — Model is too busy, please try again later.

---

[API](https://skmtc.net/betagouv/apis/opengatellm.md) · [All operations](https://skmtc.net/betagouv/apis/opengatellm/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/betagouv/opengatellm/versions/f2624a610e5a/schema)
