Embeddings (text → vector)
POST /v1/embeddings turns text into vectors for semantic retrieval, clustering, RAG knowledge-base ingestion, and similar scenarios. It uses the standard OpenAI format — any OpenAI SDK can call it directly.
1. Request
bash
curl https://token.yaoshu.cc/v1/embeddings \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{"model": "<embedding-model>", "input": "Text to embed"}'| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | ✅ | Embedding model name, as returned by GET /v1/models |
input | string / string[] | ✅ | Text to embed; an array processes a batch |
2. Response
Standard OpenAI structure: data[].embedding is the vector array, data[].index is the index of the corresponding input, and usage reports token consumption.
3. Billing
Metered by token. Unit prices are per the model pricing page in the Console.
