- OpenAI
- Claude
- Midjourney
- 翻译
- 文心一言
- Stable Diffusion
向量生成 /v1/embeddings
POST
https://api.aigc2d.com/v1/embeddings
OpenAI
请求参数
Authorization
在 Header 添加参数
Authorization
,其值为在 Bearer 之后拼接 Token示例:
Authorization: Bearer ********************
Body 参数application/json
model
enum<string> <string>
模型
枚举值:
text-embedding-ada-002
input
string <string>
需要生成向量的文本
user
string <string>
可选
示例
{
"model": "text-embedding-ada-002",
"input": "The food was delicious and the waiter..."
}
示例代码
Shell
JavaScript
Java
Swift
Go
PHP
Python
HTTP
C
C#
Objective-C
Ruby
OCaml
Dart
R
请求示例请求示例
Shell
JavaScript
Java
Swift
curl --location --request POST 'https://api.aigc2d.com/v1/embeddings' \
--header 'Content-Type: application/json' \
--data-raw '{
"model": "text-embedding-ada-002",
"input": "The food was delicious and the waiter..."
}'
返回响应
🟢200成功
application/json
Body
object
string
必需
data
array [object {3}]
必需
object
string
可选
embedding
array[number]
向量数据值
index
integer
可选
model
string
必需
usage
object
消耗
prompt_tokens
integer
输入 tokens
total_tokens
integer
总 tokens
示例
{
"object": "list",
"data": [
{
"object": "embedding",
"embedding": [
0.0023064255,
-0.009327292,
.... (1536 floats total for ada-002)
-0.0028842222,
],
"index": 0
}
],
"model": "text-embedding-ada-002",
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
}
}
修改于 2023-06-26 10:45:48