Developer docs
6. Completions, embeddings and reranking APIs
Version 1.0 · 2026-10-20
Text completions POST /v1/completions
Legacy single-prompt completion in the OpenAI Completions format, with stream support. It works only with chat models; new projects should use the Chat API.
curl https://b300.powerchampion.ai/v1/completions \
-H "Authorization: Bearer $PC_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "glm-5.2-fp8", "prompt": "The highest mountain in Taiwan is", "max_tokens": 32}'Text embeddings POST /v1/embeddings
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | bge-m3 |
input | string or array | Yes | A single text or an array of texts, each up to 8,192 tokens |
encoding_format | string | No | Only float is supported |
dimensions | integer | No | Only 1024 is supported |
resp = client.embeddings.create(
model="bge-m3",
input=["Taipei Metro operating hours", "High-speed rail fares"],
encoding_format="float",
)
vectors = [d.embedding for d in resp.data] # 1,024 dimensions eachThe response uses the OpenAI embeddings format: data[].embedding, data[].index and usage.prompt_tokens.
Document reranking POST /v1/rerank
Reorders documents by how relevant they are to a query — typically used to refine results after vector retrieval.
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | bge-reranker-v2-m3 |
query | string | Yes | The query |
documents | array of string | Yes | Documents to rank |
top_n | integer | No | Return only the top N results, 1–100 |
return_documents | boolean | No | Whether to include the document text in the results |
curl https://b300.powerchampion.ai/v1/rerank \
-H "Authorization: Bearer $PC_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "bge-reranker-v2-m3",
"query": "How do I request a refund?",
"documents": ["Refunds must be requested within 7 days", "Shipping is charged by weight", "Members earn points"],
"top_n": 2
}'{
"id": "rerank-...",
"model": "bge-reranker-v2-m3",
"results": [
{ "index": 0, "relevance_score": 0.9821 },
{ "index": 2, "relevance_score": 0.0137 }
],
"usage": { "total_tokens": 46 }
}results is sorted by relevance_score, highest first, and index points to the position in the original documents. Billing is based on the input tokens of the query and documents.