API Reference
POST /embed
Generate dense vector embeddings for up to 512 menu items in a single request. Vectors capture semantic meaning, so "Murgh Makhani" and "Butter Chicken" will have high cosine similarity.
Request
| Parameter | Type | Required | Description |
|---|---|---|---|
items | string[] | Yes | Menu item texts to embed. 1-512 items, max 500 chars each. |
dimension | int | No | Output vector dimension. Valid: 128, 256, 384. Default: 128. |
{
"items": ["Chicken Biryani", "Paneer Tikka Masala", "Masala Dosa"],
"dimension": 128
}
Response
| Field | Type | Description |
|---|---|---|
embeddings | float[][] | One vector per input item, in submission order |
dimension | int | Dimension of each vector |
count | int | Number of items embedded |
{
"embeddings": [[0.023, -0.041, ...], [0.018, -0.037, ...], [0.031, -0.028, ...]],
"dimension": 128,
"count": 3
}
Example
import requests
response = requests.post("https://embed.statode.com/embed",
headers={"X-API-Key": "YOUR_KEY", "Content-Type": "application/json"},
json={
"items": ["Chicken Biryani", "Paneer Tikka Masala", "Masala Dosa"],
"dimension": 128
}
)
data = response.json()
# data["embeddings"][0] is a 128-dimensional vector for "Chicken Biryani"
curl -X POST https://embed.statode.com/embed \
-H "X-API-Key: YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"items": ["Chicken Biryani", "Paneer Tikka Masala"], "dimension": 128}'
Cost
0.05 credits per item.
Notes
- Vectors are L2-normalized. Use cosine similarity (or dot product, equivalent for unit vectors) to compare them.
- Text is automatically cleaned before encoding: promotional noise, prices, and serving sizes are stripped, common misspellings are corrected.
- Use /embed/batch for catalogs larger than 512 items.
- Higher dimensions capture more nuance but use more storage. 128 is sufficient for most search and dedup use cases.