创建文本嵌入
curl --request POST \
--url https://api.geminix.cc/v1/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "text-embedding-ada-002",
"input": "<string>"
}
'import requests
url = "https://api.geminix.cc/v1/embeddings"
payload = {
"model": "text-embedding-ada-002",
"input": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'text-embedding-ada-002', input: '<string>'})
};
fetch('https://api.geminix.cc/v1/embeddings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.geminix.cc/v1/embeddings"
payload := strings.NewReader("{\n \"model\": \"text-embedding-ada-002\",\n \"input\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"object": "list",
"data": [
{
"object": "embedding",
"index": 123,
"embedding": [
123
]
}
],
"model": "<string>",
"usage": {
"prompt_tokens": 123,
"total_tokens": 123
}
}Embeddings
创建文本嵌入
将文本转换为向量嵌入
POST
/
v1
/
embeddings
创建文本嵌入
curl --request POST \
--url https://api.geminix.cc/v1/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "text-embedding-ada-002",
"input": "<string>"
}
'import requests
url = "https://api.geminix.cc/v1/embeddings"
payload = {
"model": "text-embedding-ada-002",
"input": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'text-embedding-ada-002', input: '<string>'})
};
fetch('https://api.geminix.cc/v1/embeddings', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.geminix.cc/v1/embeddings"
payload := strings.NewReader("{\n \"model\": \"text-embedding-ada-002\",\n \"input\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}{
"object": "list",
"data": [
{
"object": "embedding",
"index": 123,
"embedding": [
123
]
}
],
"model": "<string>",
"usage": {
"prompt_tokens": 123,
"total_tokens": 123
}
}授权
使用 Bearer Token 认证。
格式: Authorization: Bearer sk-xxxxxx
请求体
application/json
⌘I