Endpoints
Embeddings
Create vector embeddings with POST /embeddings for semantic search, clustering, deduplication and retrieval augmented generation.
Try it in the playgroundTurn text into vectors for semantic search, clustering, deduplication and retrieval-augmented generation (RAG). The endpoint has the same shape as OpenAI's POST /embeddings, so client.embeddings.create(...) works unchanged.
POST https://api14.com/api/v1/embeddings
Request
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | yes | An embeddings model id, e.g. openai/text-embedding-3-small. |
input | string or string[] | yes | Text to embed. Pass an array to embed many inputs in one request. |
dimensions | integer | no | Output vector size, for models that support shortening (e.g. text-embedding-3-*). |
encoding_format | string | no | float (default) or base64. |
user | string | no | Your own end-user id, passed through upstream. |
provider | object | no | Provider routing preferences. See Provider routing. |
Example
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api14.com/api/v1",
apiKey: process.env.API14_API_KEY,
});
const result = await client.embeddings.create({
"model": "openai/text-embedding-3-small",
"input": [
"The quick brown fox",
"Lorem ipsum"
]
});
console.log(result.data.map((d) => d.embedding.length));
Response
{
"object": "list",
"data": [
{ "object": "embedding", "index": 0, "embedding": [0.0023, -0.0091, 0.0154, "..."] }
],
"model": "openai/text-embedding-3-small",
"usage": { "prompt_tokens": 8, "total_tokens": 8, "cost": 0.00000016 }
}
data[i].index matches the position of the input in your input array.
Choosing a model
List embeddings models with their prices, without an API key:
curl https://api14.com/api/v1/embeddings/models
# or, with categories and our prices:
curl "https://api14.com/api/v1/models?category=embeddings"
Vectors from different models are not comparable. Store the model id next to every vector and re-embed your corpus when you switch models.
Pricing
Embeddings are billed per input token at the model's listed price, shown as "$ / 1M tokens". The cost of each request is returned in usage.cost (USD) and debited from your balance. See Pricing & billing.
Tips
- Batch inputs: one request with 100 strings is faster and counts as one request against your rate limit.
- Keep each input under the model's context length; longer text is rejected upstream.
- Normalize vectors (most models already return unit length) and use cosine similarity.
Errors
| Status | Code | When |
|---|---|---|
| 400 | model_required / invalid_json | Missing model or the body is not a JSON object. |
| 401 | invalid_api_key | Missing or invalid key. |
| 402 | insufficient_balance | Your USD balance is $0. |
| 403 | model_not_allowed | The key's model allowlist excludes this model. |
| 404 | model_not_found | Unknown or disabled model id. |
| 429 | rate_limited | Requests per minute exceeded. |
Full list: Errors.