Skip to content
此页面尚未提供您所用语言的版本,因此当前显示为英文。

Embeddings

Create text embeddings for search, retrieval and clustering with text-embedding-3-small and text-embedding-3-large through the OpenAI-compatible endpoint.

← 全部文档

Embeddings turn text into vectors you can store in a vector database for semantic search, retrieval-augmented generation (RAG), clustering and deduplication.

Endpoint

text
POST https://api.apisea.ai/v1/embeddings
ModelDimensionsBest for
text-embedding-3-small1536 (adjustable)Low-cost search and RAG at scale
text-embedding-3-large3072 (adjustable)Highest retrieval quality
text-embedding-ada-0021536Compatibility with existing indexes

Request

cURL
curl https://api.apisea.ai/v1/embeddings \
  -H "Authorization: Bearer $APISEA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "text-embedding-3-small", "input": ["How do I reset my password?", "Billing and invoices"]}'
Python
from openai import OpenAI
client = OpenAI(api_key="sk-sea-...", base_url="https://api.apisea.ai/v1")

resp = client.embeddings.create(model="text-embedding-3-small", input=["first text", "second text"])
vectors = [d.embedding for d in resp.data]
print(len(vectors), len(vectors[0]))

Parameters

ParameterTypeDescription
modelstringEmbedding model id.
inputstring or arrayText or list of texts to embed. Batch up to a few hundred short texts per call.
dimensionsintegerOptional. Shorten the vector (text-embedding-3 models only).
encoding_formatstringfloat (default) or base64.

Response

json
{
  "object": "list",
  "data": [{"object": "embedding", "index": 0, "embedding": [0.0023, -0.0091, ...]}],
  "model": "text-embedding-3-small",
  "usage": {"prompt_tokens": 12, "total_tokens": 12}
}

Embeddings are billed per input token at the rate on each model page.

Tips

  • Normalize and chunk documents (for example 300–800 tokens with some overlap) before embedding.
  • Use the same model for indexing and querying; vectors from different models are not comparable.
  • Store the model id alongside each vector so you can re-index safely later.

发现文档中的问题?请发送邮件至 support@apisea.ai。