Skip to main content
POST
Create Rerank

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Cohere POST /v2/rerank request body, plus Eden extensions.

Unknown top-level fields are forwarded to the provider; connection keys are rejected. routing is declared so prepare_input reads it validated; with a concrete 'provider/model' only zero_data_retention applies.

model
string
required

Model identifier in 'provider/model' format, e.g. 'cohere/rerank-v3.5'.

query
string
required

The search query to rank the documents against.

Minimum string length: 1
documents
string[]
required

The texts to rank, at most 1000.

Required array length: 1 - 1000 elements
tags
any

Up to 10 key/value labels recorded with this call, for filtering and grouping usage. Merged with the X-EdenAI-Tags header.

Example:
routing
ProviderRoutingPreferences · object | null

How to pick between the providers that serve the requested model. Applies when model is a model name with no provider prefix (e.g. 'gpt-5.5'); ignored for a concrete 'provider/model' id, which already names its provider, except zero_data_retention, which holds every model in the request to it. With model='@edenai' the platform chooses the model too: quality_cost steers that choice, and the provider fields apply whenever the chosen model is a provider-less name.

top_n
integer | null

Return only the top_n most relevant results. Defaults to all documents.

Required range: x > 0
return_documents
boolean
default:false

Echo each ranked document's text in its result under document.text.

metadata
Metadata · object | null

Arbitrary metadata attached to the request.

extra_headers
Extra Headers · object | null

Additional HTTP headers forwarded to the provider API.

Response

Successful Response

Cohere-compatible rerank response plus Eden cost and provider.

usage carries the billed units: search_units or total_tokens.

cost
number | null

Charge in USD from the row's rates; None when it cannot be computed in full (no row, an unusable rate, or no billable count for a priced unit).

provider
string | null
id
string | null

Identifier of the rerank call, as the provider returned it.

results
RerankResult · object[]

Documents ordered by relevance to the query, most relevant first.

meta
Meta · object | null

The provider's own billing metadata, as litellm returned it.

usage
RerankUsage · object

The priced units of the call; both counts are None when the provider reports neither.