Skip to main content

Documentation Index

Fetch the complete documentation index at: https://apidoc.cometapi.com/llms.txt

Use this file to discover all available pages before exploring further.

Use CometAPI embeddings when your app needs vectors for semantic search, clustering, recommendations, or retrieval. Send text to /v1/embeddings, store the returned vector, and search it with your vector database.

Create an embedding

The following example creates one embedding vector:
curl https://api.cometapi.com/v1/embeddings \
  -H "Authorization: Bearer $COMETAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-3-small",
    "input": "CometAPI lets developers use many model providers."
  }'
The response returns one vector for each input item:
{
  "object": "list",
  "data": [
    {
      "object": "embedding",
      "index": 0,
      "embedding": [
        -0.0021,
        -0.0491,
        0.0209
      ]
    }
  ],
  "model": "text-embedding-3-small",
  "usage": {
    "prompt_tokens": 10,
    "total_tokens": 10
  }
}

Batch input

The following example embeds multiple strings in one request:
curl https://api.cometapi.com/v1/embeddings \
  -H "Authorization: Bearer $COMETAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "text-embedding-3-small",
    "input": [
      "Create an API key",
      "Change the base URL",
      "Retry after a rate limit"
    ]
  }'

Common errors

ErrorFix
Input too longSplit long documents into chunks before embedding.
Wrong model typeChoose an embedding-capable model from the model directory.
Vector dimensions mismatchKeep the same model and dimensions for one vector index.
Missing API keySend Authorization: Bearer $COMETAPI_KEY.
Last updated: May 27, 2026