Embeddings
Turn text into vectors for search, clustering and retrieval. One request can embed up to 2,048 inputs.
POST/v1/embeddings
Create embeddings
curl https://api.topolabs.ai/v1/embeddings \ -H "Authorization: Bearer $TOPO_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "text-embedding-3-large", "input": ["Stake first, serve second", "Sampled re-execution"], "dimensions": 1024 }'result = client.embeddings.create( model="text-embedding-3-large", input=["Stake first, serve second", "Sampled re-execution"], dimensions=1024,) vectors = [item.embedding for item in result.data]const result = await client.embeddings.create({ model: "text-embedding-3-large", input: ["Stake first, serve second", "Sampled re-execution"], dimensions: 1024,}); const vectors = result.data.map((item) => item.embedding);Request body
modelstringRequiredAn embedding model, such as
text-embedding-3-large.inputstring | string[]RequiredText to embed. Up to 2,048 items per request and 8,192 tokens per item.
dimensionsintegerOutput size between
256and3072. Smaller vectors are cheaper to store.Default:
3072encoding_formatstringfloatorbase64. Base64 cuts response size by about 25%.Default:
float
Response
response.json
json
{ "object": "list", "model": "text-embedding-3-large", "data": [ { "object": "embedding", "index": 0, "embedding": [0.0123, -0.0481, 0.0277, ...] }, { "object": "embedding", "index": 1, "embedding": [-0.0092, 0.0314, 0.0619, ...] } ], "usage": { "prompt_tokens": 9, "total_tokens": 9 }, "topo": { "node": "us-east-4", "receipt": { "amount": "0.0000012", "currency": "USDT" } }}Pricing
text-embedding-3-large costs $0.13 per million input tokens. Embeddings have no output tokens, so the input count is the whole bill.