Skip to main content
POST
/
embeddings
文本/图片嵌入向量生成接口
curl --request POST \
  --url https://geekai.co/api/v1/embeddings \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "text-embedding-3-small",
  "input": [
    "你好"
  ],
  "intent": "search_document",
  "dimensions": 1536,
  "retries": 0
}
'
{
  "model": "text-embedding-3-small",
  "data": [
    {
      "embedding": [
        -0.006929,
        0.0023415,
        "..."
      ],
      "index": 0
    }
  ],
  "usage": {
    "prompt_tokens": 8,
    "total_tokens": 8,
    "prompt_tokens_details": {
      "text_tokens": 123,
      "image_tokens": 123
    }
  },
  "object": "list"
}
Note: For setting the embedding model name, refer to the System Supported Embedding Models List. The request/response parameter structure is fully compatible with OpenAI. When switching models, you only need to modify the corresponding model name. If the model request/response parameters are inconsistent with OpenAI, GeekAI will automatically convert and align them at the underlying level. The response data format is fully compatible with OpenAI.

cURL Request Example

curl --location 'https://geekai.dev/api/v1/embeddings' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer {YOUR_GEEKAI_API_KEY}' \
--data '{
    "input": [
        "The food was delicious and the waiter..."
    ],
    "model": "text-embedding-3-small"
}'

Authorizations

Authorization
string
header
required

API认证token

Body

application/json
model
string
required

嵌入模型

Example:

"text-embedding-3-small"

input
required

文本字符串或者图文对象列表,单行文本字符数受模型上下文长度限制

Example:
["你好"]
intent
enum<string>

嵌入意图,用于指定嵌入的使用场景,目前仅 Cohere 向量模型支持该字段,当对图片进行向量化需要指定为 image

Available options:
search_document,
search_query,
classification,
clustering,
image
dimensions
integer
default:1536

输出向量维度

Example:

1536

retries
integer
default:0

自动重试次数,默认0,表示失败不重试

Example:

0

Response

成功响应

model
string
required

使用的嵌入模型

Example:

"text-embedding-3-small"

data
object[]
required

嵌入向量数据列表

usage
object
required
object
enum<string>
default:list

响应对象类型

Available options:
list