---
title: "Embeddings, rerank and moderation API reference"
description: "Embed text, rank up to 1,000 documents against a query, and the moderation route, with the models the live catalog lists for each and every body field."
canonical: https://pentestllm.ai/docs/retrieval-and-moderation
generated: 2026-11-27T06:25:50.197Z
source: https://pentestllm.ai/docs/retrieval-and-moderation
base_url: https://api.pentestllm.ai/v1
---

[Docs](https://pentestllm.ai/docs) / API reference

# Embeddings, rerank, moderation

Updated 2026-11-22. Published by PentestLLM.

Three routes under `https://api.pentestllm.ai/v1` serve the jobs around a chat model: turning findings into vectors for search, ordering documents by how well they match a question, and classifying text. Each catalog entry’s `type` and `endpoints` fields say which route takes it.

## Routes

| Route | Body limit | Statuses |
| --- | --- | --- |
| `POST /v1/embeddings` | 10 MB | 200, 400, 401, 402, 403, 404, 413, 424, 429, 502, 503 |
| `POST /v1/rerank` | 2 MB | 200, 400, 401, 402, 403, 404, 413, 429, 502, 503 |
| `POST /v1/moderations` | 10 MB | 200, 400, 401, 402, 403, 404, 413, 424, 429, 502, 503 |

Model routes take an ordinary key through whichever accepted header suits your client: Authorization, the Anthropic one or the Google one. An admin key is refused with `403 admin_key`. Whether a console session is accepted, the OpenAPI document does not say.

## Models in the catalog now

For embeddings:

- `bge-base-en-v1.5`, $0.1665 per 1M input tokens
- `bge-m3`, $0.0295 per 1M input tokens
- `bge-small-en-v1.5`, $0.0505 per 1M input tokens
- `gemini-embedding-001`, $0.15 per 1M input tokens
- `qwen3-embedding-0.6b`, $0.0295 per 1M input tokens
- `text-embedding-3-large`, $0.1607 per 1M input tokens
- `text-embedding-3-small`, $0.4363 per 1M input tokens
- `text-embedding-ada-002`, $0.10 per 1M input tokens

For rerank:

- `bge-reranker-base`, $0.0078 per 1M input tokens

For moderation: no model is listed in the catalog today, so the route is described below without a working example.

## Embeddings

`POST /v1/embeddings` requires `model` and `input`, a string or an array; other fields in the OpenAI request shape are passed through. The success body is declared only as an open object, the embedding list the model’s route returns, so its fields are not typed in the OpenAPI document.

## Rerank

`POST /v1/rerank` follows the Cohere and Jina request shape:

| Field | Type | Notes |
| --- | --- | --- |
| `model` | string, required | A model whose catalog type is rerank. |
| `query` | string, required | The text every document is scored against. |
| `documents` | array, required | Up to 1,000 entries, each a string or an object with a text field. |
| `top_n` | integer | Keep only the best n results. All of them when unset. |
| `return_documents` | boolean | Echo each document’s text in its result. |

The answer has `id` (the request id), `object` list, `model`, `results` best first, each with the original `index`, a `relevance_score` where higher means closer, and `document.text` when asked for, plus `usage` with `prompt_tokens` and `total_tokens`. Billing is per input token: the query is counted again beside every document, at roughly four characters a token. A failed call costs nothing.

## Moderation

`POST /v1/moderations` requires `input`, a string or an array, and takes an optional `model`. Left out, the call goes to text-moderation-latest by the OpenAPI document, an id the catalog does not list today, so treat the default as unconfirmed. Its prose describes the answer as OpenAI’s moderation object with `results`, `flagged`, `categories` and `category_scores`, but the schema types none of them. With no token count in the answer, billing takes the request size divided by four.

## Errors

| Status | Codes |
| --- | --- |
| `400` | invalid_request: a malformed body, a missing required field, or a model of the wrong type for the route. |
| `401` | invalid_api_key: no key, a key in the URL, or a key that is invalid or revoked. |
| `402` | insufficient_balance, spend_cap_reached, a key limit such as monthly_limit_reached, or key_budget_exhausted. |
| `403` | scope_denied when the key may not use the model, admin_key, account_frozen. |
| `404` | model_not_found: the id is not in the catalog. |
| `413` | invalid_request: the body passed its ceiling. |
| `424` | mcp_server_error, declared on embeddings and moderation only. |
| `429` | rate_limited, or upstream_rate_limited when the model is busy. |
| `502` | upstream_error: the last route tried failed. Not charged. |
| `503` | upstream_unavailable: no route for the model can answer now (typed overloaded_error in Anthropic-format answers). |

Embeddings and moderation also list user_budget_reached and the daily and weekly limits under 402, credential_required under 403, and session_cap and loop_detected under 429; see [Spend limits](https://pentestllm.ai/docs/spend-limits).

## Example

```bash
curl "https://api.pentestllm.ai/v1/rerank" \
  -H "Authorization: Bearer sk-ptl-live-…" \
  -H "Content-Type: application/json" \
  -d '{"model": "bge-reranker-base", "query": "Which finding involves exposed credentials?", "documents": ["An API token appears in a debug log.", "A response omits a cache header."], "top_n": 1}'
```

## Questions

### Can I rerank with a chat model?

No. Pick a catalog entry whose type is rerank and whose endpoints include the rerank route; a model of another type is turned away with a 400.

### Where is the embeddings response schema?

The OpenAPI document leaves it as an open object, passed on as the model route returns it. This page does not guess vector sizes or fields from another provider’s docs.

### Can I moderate text today?

The route is documented, but whether a model answers on it depends on the catalog. The list above is read from the live catalog and says when none is listed.

## Read next

- [MCP servers](https://pentestllm.ai/docs/mcp-servers)
- [Log export](https://pentestllm.ai/docs/exports)
- [Invoices](https://pentestllm.ai/docs/invoices)
- [Billing details](https://pentestllm.ai/docs/billing-details)
- [Statement signing key](https://pentestllm.ai/docs/statements-public-key)
- [Keys and scopes](https://pentestllm.ai/docs/keys)
- [Usage and signed receipts](https://pentestllm.ai/docs/usage-and-receipts)
- [Spend limits and balance](https://pentestllm.ai/docs/spend-limits)
- [Redaction and guardrails](https://pentestllm.ai/docs/redaction-and-guardrails)
- [Sessions](https://pentestllm.ai/docs/sessions)
- [Batch files](https://pentestllm.ai/docs/files)
- [Batches](https://pentestllm.ai/docs/batches)
- [Status and proof feeds](https://pentestllm.ai/docs/status-and-proof)
- [Count tokens](https://pentestllm.ai/docs/count-tokens)
- [Usage by app](https://pentestllm.ai/docs/stats-apps)
- [App sign-in keys](https://pentestllm.ai/docs/auth-keys)
- [Webhook deliveries](https://pentestllm.ai/docs/webhooks-deliveries)
- [Docs: connect in two minutes](https://pentestllm.ai/docs)
- [Endpoints](https://pentestllm.ai/features/endpoints)
- [Models](https://pentestllm.ai/models)
