Search Documentation

Search for pages and headings in the documentation

Embeddings

Generate vector embeddings for text input. Use with jade-mole-4.

Endpoint

POST /v1/embeddings

Request body

ParameterTypeRequiredDescription
modelstringYesMust be jade-mole-4.
inputstring or arrayYesText(s) to embed.
encoding_formatstringNofloat (default) or base64.

Example request

curl https://api.liutong.llby.org/v1/embeddings \
  -H "Authorization: Bearer lt_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "jade-mole-4",
    "input": "Liutong makes LLM inference affordable."
  }'

Response

{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [0.0023, -0.0091, 0.0152, ...]
    }
  ],
  "model": "jade-mole-4",
  "usage": {
    "prompt_tokens": 7,
    "total_tokens": 7
  }
}

Batch input

Pass an array to embed multiple texts in one request:

curl https://api.liutong.llby.org/v1/embeddings \
  -H "Authorization: Bearer lt_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "jade-mole-4",
    "input": [
      "First document.",
      "Second document.",
      "Third document."
    ]
  }'

Each item in the data array corresponds to the input at the same index.

Error responses

StatusDescription
401Invalid or missing API key.
400Malformed request body.
404Model not found.
500Internal server error.