Embeddings
OpenAI-compatible embeddings under the same wallet — semantic search, RAG, and clustering with in-band cost.
POST /v1/embeddings turns text into vectors for semantic search, RAG,
recommendations, deduplication, and clustering. It is wire-identical to the
OpenAI Embeddings API, so the SDK works with just the base URL swap — and as
everywhere on Gopuram, the exact billed cost rides in the response.
from openai import OpenAI
client = OpenAI(base_url="https://api.gopuram.net/v1", api_key=GOPURAM_API_KEY)
result = client.embeddings.create(
model="alibaba/qwen3-embedding-0.6b",
input=["the gopuram rises over the temple", "an unrelated sentence"],
)
print(len(result.data), "vectors")
print(result.usage) # prompt_tokens + cost, in-band
curl https://api.gopuram.net/v1/embeddings \
-H "Authorization: Bearer $GOPURAM_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "alibaba/qwen3-embedding-0.6b", "input": "the gopuram rises"}'
Request
| Field | Type | Notes |
|---|---|---|
model | string | any embedding model from the catalog |
input | string or string[] | up to 2,048 items / 1M characters total |
encoding_format | "float" | "base64" | optional, passed through |
dimensions | int | optional — models that support Matryoshka truncation honor it |
Response
The OpenAI shape, plus usage.cost:
{
"object": "list",
"data": [{ "object": "embedding", "index": 0, "embedding": [0.0123, …] }],
"model": "alibaba/qwen3-embedding-0.6b",
"usage": { "prompt_tokens": 8, "total_tokens": 8, "cost": 0.000000168 }
}
Embeddings bill on input tokens only, at the rate shown per model in the
catalog (margin included; the figure matches usage.cost exactly). Filter
the live catalog for embedding models:
curl -s https://api.gopuram.net/v1/models \
| jq '.data[] | select(.architecture.output_modalities == ["embedding"]) | {id, pricing}'
Cheap bulk pick: alibaba/qwen3-embedding-0.6b ($0.01/M). Highest quality:
google/gemini-embedding-001 or cohere/embed-v4.0. Sending a chat model
here (or an embedding model to /v1/chat/completions) returns a 400
naming the right endpoint.