Berget AI Rerank API
Rerank documents based on their relevance to a specific query
Rerank documents based on their relevance to a specific query
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/berget-ai:berget-ai-rerank-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Berget Ai Rerank API
version: 1.0.0
contact:
name: Berget AI Support
email: support@berget.ai
url: https://berget.ai/support
license:
name: Proprietary
url: https://berget.ai/terms
description: 'Operations tagged Rerank across 2 of this provider''s published API definitions: berget-ai-openapi.json, berget-ai-openapi.yml. Each path carries the servers of the definition it was published in.'
servers:
- url: https://api.berget.ai
description: Production API
- url: https://api.stage.berget.ai
description: Stage API
tags:
- name: Rerank
description: Rerank documents based on their relevance to a specific query
paths:
/v1/rerank/:
post:
operationId: rerank
summary: Rerank documents
tags:
- Rerank
description: 'Reranks a list of documents based on their relevance to a query.
This endpoint is useful for:
- Improving search results by reranking based on semantic similarity
- Sorting documents by relevance to a specific query
- Enhancing retrieval-augmented generation (RAG) systems
Compatible with the Cohere rerank API format.
## Quick Start
Basic usage only requires a query and documents:
```json
{
"query": "What is machine learning?",
"documents": [
"Machine learning is a branch of artificial intelligence.",
"Natural language processing is used in many applications.",
"Deep learning is a subset of machine learning."
]
}
```
The API will use the default model (BAAI/bge-reranker-v2-m3) and return the top 3 most relevant documents.'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CohereRerankRequestInput'
security:
- BearerAuth: []
responses:
'200':
description: Successfully reranked documents
content:
application/json:
schema:
description: Successfully reranked documents
allOf:
- $ref: '#/components/schemas/CohereRerankResponse'
'400':
description: Invalid request
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
message:
type: string
description: Human-readable error message
type:
type: string
description: Error type (e.g. "invalid_request_error")
param:
description: The parameter that caused the error
type:
- string
- 'null'
code:
description: Error code
type:
- string
- 'null'
required:
- message
- type
- code
additionalProperties: false
required:
- error
additionalProperties: false
description: Invalid request
'401':
description: Authentication error
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
message:
type: string
description: Human-readable error message
type:
type: string
description: Error type (e.g. "invalid_request_error")
param:
description: The parameter that caused the error
type:
- string
- 'null'
code:
description: Error code
type:
- string
- 'null'
required:
- message
- type
- code
additionalProperties: false
required:
- error
additionalProperties: false
description: Authentication error
'403':
description: Permission error
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
message:
type: string
description: Human-readable error message
type:
type: string
description: Error type (e.g. "invalid_request_error")
param:
description: The parameter that caused the error
type:
- string
- 'null'
code:
description: Error code
type:
- string
- 'null'
required:
- message
- type
- code
additionalProperties: false
required:
- error
additionalProperties: false
description: Permission error
'404':
description: Model not found
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
message:
type: string
description: Human-readable error message
type:
type: string
description: Error type (e.g. "invalid_request_error")
param:
description: The parameter that caused the error
type:
- string
- 'null'
code:
description: Error code
type:
- string
- 'null'
required:
- message
- type
- code
additionalProperties: false
required:
- error
additionalProperties: false
description: Model not found
'500':
description: Server error
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
message:
type: string
description: Human-readable error message
type:
type: string
description: Error type (e.g. "invalid_request_error")
param:
description: The parameter that caused the error
type:
- string
- 'null'
code:
description: Error code
type:
- string
- 'null'
required:
- message
- type
- code
additionalProperties: false
required:
- error
additionalProperties: false
description: Server error
'503':
description: Service unavailable
content:
application/json:
schema:
type: object
properties:
error:
type: object
properties:
message:
type: string
description: Human-readable error message
type:
type: string
description: Error type (e.g. "invalid_request_error")
param:
description: The parameter that caused the error
type:
- string
- 'null'
code:
description: Error code
type:
- string
- 'null'
required:
- message
- type
- code
additionalProperties: false
required:
- error
additionalProperties: false
description: Service unavailable
servers:
- url: https://api.berget.ai
description: Production API
- url: https://api.stage.berget.ai
description: Stage API
components:
schemas:
CohereRerankResponse:
type: object
properties:
id:
description: Unique identifier for the rerank operation
type: string
model:
type: string
description: Canonical model ID
object:
description: Object type discriminator.
type: string
enum:
- reranking
results:
type: array
items:
type: object
properties:
index:
type: number
description: Index into the original list of documents
relevance_score:
type: number
description: Relevance score (0–1)
document:
description: Echo of the input document, present only when return_documents is true
anyOf:
- type: string
- $ref: '#/components/schemas/CohereRerankDocument'
required:
- index
- relevance_score
additionalProperties: false
description: An ordered list of ranked documents
meta:
description: Request metadata. Not all fields are populated by upstream providers.
type: object
properties:
api_version:
type: object
properties:
version:
type: string
is_deprecated:
type: boolean
is_experimental:
type: boolean
required:
- version
additionalProperties: false
billed_units:
type: object
properties:
images:
type: number
input_tokens:
type: number
image_tokens:
type: number
output_tokens:
type: number
search_units:
type: number
classifications:
type: number
additionalProperties: false
tokens:
type: object
properties:
input_tokens:
type: number
output_tokens:
type: number
additionalProperties: false
cached_tokens:
type: number
additionalProperties: false
usage:
description: Token usage (Berget/upstream extension; not part of the Cohere v1 spec).
type: object
properties:
prompt_tokens:
type: number
total_tokens:
type: number
required:
- total_tokens
additionalProperties: false
required:
- model
- results
additionalProperties: {}
CohereRerankDocumentInput:
type: object
properties:
text:
type: string
minLength: 1
description: The text of the document to rerank
required:
- text
additionalProperties: {}
CohereRerankRequestInput:
type: object
properties:
model:
description: The identifier of the model to use. Optional in v1, though callers should send it.
type: string
query:
type: string
minLength: 1
description: The search query
documents:
minItems: 1
type: array
items:
anyOf:
- type: string
minLength: 1
- $ref: '#/components/schemas/CohereRerankDocumentInput'
description: A list of document objects or strings to rerank
top_n:
description: The number of most relevant documents/indices to return. Defaults to the length of documents.
type: integer
minimum: 1
maximum: 9007199254740991
rank_fields:
description: For object documents, which keys to consider for reranking, in priority order. Forwarded to the upstream provider when supported.
type: array
items:
type: string
return_documents:
default: false
description: If true, returns document text/objects in results. Defaults to false per Cohere v1 spec.
type: boolean
max_chunks_per_doc:
default: 10
description: The maximum number of chunks to produce internally from a document. Forwarded to upstream when supported.
type: integer
minimum: -9007199254740991
maximum: 9007199254740991
required:
- query
- documents
additionalProperties: {}
CohereRerankDocument:
type: object
properties:
text:
type: string
minLength: 1
description: The text of the document to rerank
required:
- text
additionalProperties: {}
securitySchemes:
BearerAuth:
type: http
scheme: bearer
bearerFormat: JWT or API key
description: 'Bearer token or API key. Pass either a JWT token or an API key (sk_ber_*) in the Authorization header as: Bearer <token>'
x-refined-from:
- berget-ai-openapi.json
- berget-ai-openapi.yml