Skip to documentation
DEVELOPER DOCS / HASHBIDXMODEL ACCESS. ONE INTEGRATION.

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/embeddings

Key request parameters

ParameterTypeDescription
modelstring · RequiredEmbedding model identifier, e.g. text-embedding-3-large
inputstring | string[] · RequiredText 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_formatenumfloat (default) returns number arrays; base64 returns an encoded string. Forwarded upstream as-is — the gateway never transcodes vectors, and support varies by upstream.
dimensionsintegerRequested vector size; must be greater than 0. Forwarded as-is — an upstream that does not support it returns its native size.
userstringEnd-user identifier for abuse tracking

Key response parameters

ParameterTypeDescription
objectstringAlways list
dataEmbeddingData[]One entry per input, aligned with the request order
data[].objectstringAlways embedding
data[].indexintegerPosition of the source input
data[].embeddingnumber[] | stringNumber array with encoding_format=float; encoded string with base64
modelstringModel that produced the vectors
usage.prompt_tokensintegerInput tokens — the billed amount
usage.total_tokensintegerEqual to prompt_tokens; the output counters are always 0
X-HashBid-Costdecimal stringCharge 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
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
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
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
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
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.

All API endpoints
BUILD WITH HASHBIDX

Find your model. Make your first call.

Models & pricing