Embeddings

Create Embeddings

Turn text, or images from your own library, into vectors for memory, search, recommendations and near-duplicate detection. OpenAI-compatible.

spicy-embed-1 embeds text ($0.14 per 1M tokens): companion memory, prompt search, recommendations. 1024 dimensions by default, 64 to 2048 with dimensions. Works with the OpenAI SDK's client.embeddings.create.

spicy-embed-vision-1 puts images and text in one 768-dimension space (text $0.18, images $0.06 per 1M tokens): "more like this" search over your generations, tagging, dedupe. Every image must be an output of your own account (the same provenance rule as every image input); a text query and an image land in the same space, so you can search images with words.

Up to 10 inputs per request, each up to 8,192 tokens. Billed on the tokens used (minimum $0.00001 per request). Nothing is generated, so inputs are not screened. Sandbox keys get deterministic fixture vectors and pay nothing.

POST/v1/embeddingsTry it
Create Embeddings
cURL
curl --request POST \
  --url https://api.spicyapi.com/v1/embeddings \
  --header 'Authorization: Bearer $SPICYAPI_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "spicy-embed-1",
    "input": ["She likes rainy evenings and old jazz records.", "Her favourite drink is a dirty martini."],
    "dimensions": 512
  }'

# images and text in one space: search your library with words
curl --request POST \
  --url https://api.spicyapi.com/v1/embeddings \
  --header 'Authorization: Bearer $SPICYAPI_KEY' \
  --header 'Content-Type: application/json' \
  --data '{
    "model": "spicy-embed-vision-1",
    "input": [
      { "image": "https://cdn.spicyapi.com/outputs/a1b2/sj_2f1c7e9a-0.png" },
      { "text": "red silk robe on a hotel balcony at night" }
    ]
  }'
200
JSON
{
  "object": "list",
  "model": "spicy-embed-1",
  "data": [
    { "object": "embedding", "index": 0, "embedding": [0.0213, -0.0447, 0.0132, "..."] },
    { "object": "embedding", "index": 1, "embedding": [-0.0081, 0.0356, 0.0274, "..."] }
  ],
  "usage": { "prompt_tokens": 22, "total_tokens": 22 },
  "cost_usd": 0.00001
}

Authorizations

Authorizationstringheaderrequired

Bearer authentication header of the form Bearer <token>, where <token> is your SpicyAPI key (sk-spicy-…). Create one in the dashboard under API Keys.

Body

application/json
modelstringrequired

spicy-embed-1 or spicy-embed-vision-1.

inputstring | arrayrequired

A string or an array of up to 10 items. On spicy-embed-1 every item is a string. On spicy-embed-vision-1 an item is a string, { "text": "..." } or { "image": "https://..." } where the image is one of your generated images.

dimensionsinteger

spicy-embed-1 only: 64, 128, 256, 512, 768, 1024 (default), 1536 or 2048. spicy-embed-vision-1 always returns 768 and rejects it.

encoding_formatstring

float (default) or base64 (little-endian float32).

Response

200 · application/json

Successful Response

objectstringrequired

Always list.

modelstringrequired

The model used.

dataEmbedding · object[]required

One vector per input, in order.

usageobjectrequired

Token counts, as in the OpenAI API.

cost_usdnumberrequired

What this request cost, in US dollars, already debited from your balance.

Was this page helpful?