Chuyển tới nội dung chính

Embeddings

This page contains the endpoints related to text-embedding capabilities.

Pham vi Apifox

  • Create text embeddings (OpenAI)
  • Batch create embeddings (OpenAI)
  • Create text embeddings (Gemini)

API model / Embeddings

POST Create Text Embedding (Gemini)

POST /embeddings

Body Parameters

{
"input": "Your text string goes here",
"model": "gemini-embedding-001"
}

Request Parameters

NameInTypeRequiredDescription
AuthorizationheaderstringNonone
bodybodyobjectNonone
» modelbodystringYesID of the model to use. You can call the List models API to see all available models, or review the model overview for descriptions.
» inputbodystringYesInput text to embed, encoded as a string or token array. To create embeddings for multiple inputs in a single request, pass an array of strings or an array of token arrays. Each input must not exceed 8192 tokens.

Response Example

200 Response

{
"object": "string",
"data": [
{
"object": "string",
"embedding": [
0
],
"index": 0
}
],
"model": "string",
"usage": {
"prompt_tokens": 0,
"total_tokens": 0
}
}

Responses

StatusMeaningDescriptionModel
200OKnoneInline

Response Schema

Status 200

NameTypeRequiredConstraintsChinese NameDescription
» objectstringtruenonenone
» data[object]truenonenone
»» objectstringfalsenonenone
»» embedding[number]falsenonenone
»» indexintegerfalsenonenone
» modelstringtruenonenone
» usageobjecttruenonenone
»» prompt_tokensintegertruenonenone
»» total_tokensintegertruenonenone