Embeddings & Rerank
Used together they build RAG (retrieval-augmented generation) applications: embeddings turn text into vectors for semantic search, and rerank re-orders retrieved candidates by relevance.
Text Embeddings
Send text to /v1/embeddings and get vectors back. For available models and prices see the Model Plaza (look for names containing embedding); below we use text-embedding-v4.
Each entry in the returned data array contains an embedding (float vector) and an index; usage records billed tokens. Vectors are for storage (e.g. in a vector database) and retrieval — don't try to read them directly.
Rerank
Send a query plus candidate documents to /v1/rerank and get results sorted by relevance. For available models see the Model Plaza (look for names containing rerank); below we use qwen3-rerank.
The returned results array is sorted by relevance in descending order; each entry contains an index (subscript into documents) and a relevance_score.
