Skip to content

Usage

Our embedding models expose the OpenAI-compatible Embeddings API:

  • /v1/embeddings: create an embedding vector for the given input

This means you can use our embedding models with any of the OpenAI SDKs or with any framework that supports custom OpenAI-compatible embedding endpoints.

💡 Embeddings are billed on input tokens only — there are no output tokens.

Examples

Create an embedding

sh
curl -X POST https://api.libertai.io/v1/embeddings \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "bge-m3",
    "input": "The quick brown fox jumps over the lazy dog"
  }'

Batch inputs

Pass a list of strings to embed many texts in a single request:

sh
curl -X POST https://api.libertai.io/v1/embeddings \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "bge-m3",
    "input": ["first document", "second document", "third document"]
  }'

The response follows the OpenAI format: a data array of { "embedding": [...], "index": n } objects, plus a usage object reporting prompt_tokens (and total_tokens, equal — embeddings have no completion tokens).