PlatformAPI documentation

Developer docs

6. Completions, embeddings and reranking APIs

Version 1.0 · 2026-10-20

← Back to the API reference

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.

bash
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

ParameterTypeRequiredDescription
modelstringYesbge-m3
inputstring or arrayYesA single text or an array of texts, each up to 8,192 tokens
encoding_formatstringNoOnly float is supported
dimensionsintegerNoOnly 1024 is supported
python
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 each

The 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.

ParameterTypeRequiredDescription
modelstringYesbge-reranker-v2-m3
querystringYesThe query
documentsarray of stringYesDocuments to rank
top_nintegerNoReturn only the top N results, 1–100
return_documentsbooleanNoWhether to include the document text in the results
bash
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
  }'
json
{
  "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.