OpenAI compatible
Embeddings
Turns text into vector embeddings for search, clustering, and RAG. OpenAI Embeddings compatible — the official SDKs work unchanged. Billed on input tokens only; embeddings generate no output tokens, and there is no streaming form of this endpoint.
POST
/v1/embeddingsKey request parameters
| Parameter | Type | Description |
|---|---|---|
model | string · Required | Embedding model identifier, e.g. text-embedding-3-large |
input | string | string[] · Required | Text to embed — one string, or an array for a batch. An empty string, an empty array, or an array containing an empty string is rejected with 400. |
encoding_format | enum | float (default) returns number arrays; base64 returns an encoded string. Forwarded upstream as-is — the gateway never transcodes vectors, and support varies by upstream. |
dimensions | integer | Requested vector size; must be greater than 0. Forwarded as-is — an upstream that does not support it returns its native size. |
user | string | End-user identifier for abuse tracking |
Key response parameters
| Parameter | Type | Description |
|---|---|---|
object | string | Always list |
data | EmbeddingData[] | One entry per input, aligned with the request order |
data[].object | string | Always embedding |
data[].index | integer | Position of the source input |
data[].embedding | number[] | string | Number array with encoding_format=float; encoded string with base64 |
model | string | Model that produced the vectors |
usage.prompt_tokens | integer | Input tokens — the billed amount |
usage.total_tokens | integer | Equal to prompt_tokens; the output counters are always 0 |
X-HashBid-Cost | decimal string | Charge for this call (response header, non-streaming requests only); currency in X-HashBid-Cost-Currency |
Integration examples
Replace the API key and model ID in these examples with your values.
cURL
curl https://hashbidx.ai/v1/embeddings \
-H "Authorization: Bearer <YOUR_API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"model": "text-embedding-3-large",
"input": "HashBid turns text into vectors"
}'Python
from openai import OpenAI
client = OpenAI(api_key="<YOUR_API_KEY>", base_url="https://hashbidx.ai/v1")
result = client.embeddings.create(
model="text-embedding-3-large",
input=["first document", "second document"],
)
for item in result.data:
print(item.index, len(item.embedding))
print(result.usage.prompt_tokens)Node.js
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "<YOUR_API_KEY>",
baseURL: "https://hashbidx.ai/v1",
});
const result = await client.embeddings.create({
model: "text-embedding-3-large",
input: ["first document", "second document"],
});
console.log(result.data.map((item) => item.embedding.length));Go
body, _ := json.Marshal(map[string]any{
"model": "text-embedding-3-large",
"input": []string{"first document", "second document"},
})
req, _ := http.NewRequest("POST",
"https://hashbidx.ai/v1/embeddings", bytes.NewReader(body))
req.Header.Set("Authorization", "Bearer <YOUR_API_KEY>")
req.Header.Set("Content-Type", "application/json")
resp, err := http.DefaultClient.Do(req)Rust
let resp = reqwest::Client::new()
.post("https://hashbidx.ai/v1/embeddings")
.bearer_auth("<YOUR_API_KEY>")
.json(&serde_json::json!({
"model": "text-embedding-3-large",
"input": ["first document", "second document"],
}))
.send().await?;
let body: serde_json::Value = resp.json().await?;If the response includes X-Request-Id, include it when troubleshooting an issue.