Skip to main content
POST
/
embeddings
curl https://www.samuraiapi.in/v1/embeddings \
  -H "Authorization: Bearer $SAMURAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-3-small",
    "input": "The way of the samurai"
  }'
{
  "object": "list",
  "data": [
    {
      "index": 0,
      "object": "embedding",
      "embedding": [0.0023064255, -0.009327292, 0.015797656, "...1536 total floats..."]
    }
  ],
  "model": "text-embedding-3-small",
  "usage": {
    "prompt_tokens": 8,
    "total_tokens": 8
  }
}
model
string
required
Embedding model. Options: text-embedding-3-small (1536 dims, fast), text-embedding-3-large (3072 dims, best accuracy), text-embedding-ada-002 (legacy).
input
string | array
required
Text to embed. Pass a single string or an array of strings for batch embedding.
encoding_format
string
default:"float"
float returns an array of numbers. base64 returns a base64-encoded string (smaller payload).
dimensions
integer
Number of output dimensions (model-dependent). Only for text-embedding-3-* models.
curl https://www.samuraiapi.in/v1/embeddings \
  -H "Authorization: Bearer $SAMURAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-3-small",
    "input": "The way of the samurai"
  }'
{
  "object": "list",
  "data": [
    {
      "index": 0,
      "object": "embedding",
      "embedding": [0.0023064255, -0.009327292, 0.015797656, "...1536 total floats..."]
    }
  ],
  "model": "text-embedding-3-small",
  "usage": {
    "prompt_tokens": 8,
    "total_tokens": 8
  }
}