# Aile Rerank API

> Aile Rerank API is a paid API for AI agents from api.aile.sh, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-10).

Reranks a list of documents by relevance to a query using premium AI reranking models, billed per call in USDC on Solana

## Facts

- Endpoint: POST https://api.aile.sh/v1/rerank?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-10
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/aile-rerank-api-2b5f86b1
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_1nf-s_HiMrWs9UtLWjIZa

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability aile-rerank-api-2b5f86b1 -d '<json body>'
```

Example prompt: Rerank these 20 passages against the query 'climate change effects on agriculture' using openrouter/cohere/rerank-4-pro and return the top 5 with their relevance scores.

## When to prefer this

Choose this endpoint when you need a pay-per-call reranking service without managing your own model subscriptions, especially when you want access to premium models like Cohere Rerank 4 Pro via a metered USDC marketplace. It is ideal for RAG pipelines, semantic search post-processing, and any scenario where you need to reorder a candidate document set by relevance to a query without committing to a direct API subscription.

## Known failure modes

- Invalid or unavailable model identifier returns an error — check GET /v1/models?output_modalities=rerank for valid options
- More than 100 documents per request exceeds the limit and will be rejected
- Insufficient USDC balance causes payment failure and the call is not executed
- Malformed query or empty documents array returns a validation error
- Network latency or model provider downtime may cause timeouts

## How this service works

Rent trusted AI models priced per token; lend idle subscriptions and API keys. A live, metered market that settles every call in USDC on Solana.

## Output

Returns a ranked list of result objects, each containing the original document index, an optional document text snippet, and a relevance_score (0–1) indicating how closely the document matches the query, sorted by descending relevance.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "model",
  "query",
  "documents"
 ],
 "properties": {
  "model": {
   "type": "string",
   "description": "`<provider>/<model>`, e.g. `openrouter/cohere/rerank-4-pro`. GET /v1/models?output_modalities=rerank lists what is servable, with prices."
  },
  "query": {
   "type": "string"
  },
  "top_n": {
   "type": "integer"
  },
  "documents": {
   "type": "array",
   "description": "Up to 100 documents per search."
  },
  "return_documents": {
   "type": "boolean"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "object": "list",
 "results": [
  {
   "index": 2,
   "document": {
    "text": "…"
   },
   "relevance_score": 0.91
  }
 ]
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/aile-rerank-api-2b5f86b1/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.aile.sh](https://www.zero.xyz/host/api.aile.sh/llms.txt)
