curl --request POST \
--url https://api.deapi.ai/api/v1/client/txt2embedding \
--header 'Accept: <accept>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "This is a sample text for embedding generation.",
"model": "Bge_M3_FP16",
"return_result_in_response": false,
"webhook_url": "https://your-server.com/webhooks/deapi"
}
'import requests
url = "https://api.deapi.ai/api/v1/client/txt2embedding"
payload = {
"input": "This is a sample text for embedding generation.",
"model": "Bge_M3_FP16",
"return_result_in_response": False,
"webhook_url": "https://your-server.com/webhooks/deapi"
}
headers = {
"Accept": "<accept>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Accept: '<accept>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
input: 'This is a sample text for embedding generation.',
model: 'Bge_M3_FP16',
return_result_in_response: false,
webhook_url: 'https://your-server.com/webhooks/deapi'
})
};
fetch('https://api.deapi.ai/api/v1/client/txt2embedding', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.deapi.ai/api/v1/client/txt2embedding",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'input' => 'This is a sample text for embedding generation.',
'model' => 'Bge_M3_FP16',
'return_result_in_response' => false,
'webhook_url' => 'https://your-server.com/webhooks/deapi'
]),
CURLOPT_HTTPHEADER => [
"Accept: <accept>",
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.deapi.ai/api/v1/client/txt2embedding"
payload := strings.NewReader("{\n \"input\": \"This is a sample text for embedding generation.\",\n \"model\": \"Bge_M3_FP16\",\n \"return_result_in_response\": false,\n \"webhook_url\": \"https://your-server.com/webhooks/deapi\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Accept", "<accept>")
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))
}HttpResponse<String> response = Unirest.post("https://api.deapi.ai/api/v1/client/txt2embedding")
.header("Accept", "<accept>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"This is a sample text for embedding generation.\",\n \"model\": \"Bge_M3_FP16\",\n \"return_result_in_response\": false,\n \"webhook_url\": \"https://your-server.com/webhooks/deapi\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deapi.ai/api/v1/client/txt2embedding")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = '<accept>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": \"This is a sample text for embedding generation.\",\n \"model\": \"Bge_M3_FP16\",\n \"return_result_in_response\": false,\n \"webhook_url\": \"https://your-server.com/webhooks/deapi\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"request_id": "c08a339c-73e5-4d67-a4d5-231302fbff9a"
}
}{
"data": {},
"message": "<string>",
"errors": [
"<unknown>"
],
"statusCode": 123
}{
"data": {},
"message": "<string>",
"errors": [
"<unknown>"
],
"statusCode": 123
}{
"message": "The selected model does not support Text To Image.",
"errors": {
"model": [
"The selected model does not support Text To Image."
]
}
}{
"message": "Too Many Attempts."
}Text-to-Embedding
Endpoint for requesting text to embedding inference
curl --request POST \
--url https://api.deapi.ai/api/v1/client/txt2embedding \
--header 'Accept: <accept>' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"input": "This is a sample text for embedding generation.",
"model": "Bge_M3_FP16",
"return_result_in_response": false,
"webhook_url": "https://your-server.com/webhooks/deapi"
}
'import requests
url = "https://api.deapi.ai/api/v1/client/txt2embedding"
payload = {
"input": "This is a sample text for embedding generation.",
"model": "Bge_M3_FP16",
"return_result_in_response": False,
"webhook_url": "https://your-server.com/webhooks/deapi"
}
headers = {
"Accept": "<accept>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
Accept: '<accept>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
input: 'This is a sample text for embedding generation.',
model: 'Bge_M3_FP16',
return_result_in_response: false,
webhook_url: 'https://your-server.com/webhooks/deapi'
})
};
fetch('https://api.deapi.ai/api/v1/client/txt2embedding', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.deapi.ai/api/v1/client/txt2embedding",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'input' => 'This is a sample text for embedding generation.',
'model' => 'Bge_M3_FP16',
'return_result_in_response' => false,
'webhook_url' => 'https://your-server.com/webhooks/deapi'
]),
CURLOPT_HTTPHEADER => [
"Accept: <accept>",
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.deapi.ai/api/v1/client/txt2embedding"
payload := strings.NewReader("{\n \"input\": \"This is a sample text for embedding generation.\",\n \"model\": \"Bge_M3_FP16\",\n \"return_result_in_response\": false,\n \"webhook_url\": \"https://your-server.com/webhooks/deapi\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Accept", "<accept>")
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))
}HttpResponse<String> response = Unirest.post("https://api.deapi.ai/api/v1/client/txt2embedding")
.header("Accept", "<accept>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": \"This is a sample text for embedding generation.\",\n \"model\": \"Bge_M3_FP16\",\n \"return_result_in_response\": false,\n \"webhook_url\": \"https://your-server.com/webhooks/deapi\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deapi.ai/api/v1/client/txt2embedding")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = '<accept>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": \"This is a sample text for embedding generation.\",\n \"model\": \"Bge_M3_FP16\",\n \"return_result_in_response\": false,\n \"webhook_url\": \"https://your-server.com/webhooks/deapi\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"request_id": "c08a339c-73e5-4d67-a4d5-231302fbff9a"
}
}{
"data": {},
"message": "<string>",
"errors": [
"<unknown>"
],
"statusCode": 123
}{
"data": {},
"message": "<string>",
"errors": [
"<unknown>"
],
"statusCode": 123
}{
"message": "The selected model does not support Text To Image.",
"errors": {
"model": [
"The selected model does not support Text To Image."
]
}
}{
"message": "Too Many Attempts."
}slug, check specific limits and features, and verify LoRA availability.Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
application/json Body
Text to embedding conversion parameters
Input text(s) to generate embeddings for. Can be a single string or array of strings (max 2048 items). Each input limited to 8192 tokens, total request limited to 300k tokens.
"This is a sample text for embedding generation."
The embedding model to use. Available models can be retrieved via the GET /api/v1/client/models endpoint.
"Bge_M3_FP16"
If true, the embedding result will be returned directly in the response instead of only download url. Optional parameter.
false
Optional HTTPS URL to receive webhook notifications for job status changes (processing, completed, failed). Must be HTTPS. Max 2048 characters. See Webhook Documentation for payload structure and authentication details.
2048"https://your-server.com/webhooks/deapi"
Response
ID of the inference request.
Information from success endpoint
Show child attributes
Show child attributes
Was this page helpful?