cURL
curl --request POST \
--url https://api.deapi.ai/api/v2/embeddings/price \
--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"
}
'import requests
url = "https://api.deapi.ai/api/v2/embeddings/price"
payload = {
"input": "This is a sample text for embedding generation.",
"model": "Bge_M3_FP16"
}
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'})
};
fetch('https://api.deapi.ai/api/v2/embeddings/price', 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/v2/embeddings/price",
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'
]),
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/v2/embeddings/price"
payload := strings.NewReader("{\n \"input\": \"This is a sample text for embedding generation.\",\n \"model\": \"Bge_M3_FP16\"\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/v2/embeddings/price")
.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}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deapi.ai/api/v2/embeddings/price")
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}"
response = http.request(request)
puts response.read_body{
"data": {
"price": 0.0003
}
}{
"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."
}Embeddings
Embeddings Price Calculation
Estimate the price of an embedding request.
POST
/
api
/
v2
/
embeddings
/
price
cURL
curl --request POST \
--url https://api.deapi.ai/api/v2/embeddings/price \
--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"
}
'import requests
url = "https://api.deapi.ai/api/v2/embeddings/price"
payload = {
"input": "This is a sample text for embedding generation.",
"model": "Bge_M3_FP16"
}
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'})
};
fetch('https://api.deapi.ai/api/v2/embeddings/price', 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/v2/embeddings/price",
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'
]),
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/v2/embeddings/price"
payload := strings.NewReader("{\n \"input\": \"This is a sample text for embedding generation.\",\n \"model\": \"Bge_M3_FP16\"\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/v2/embeddings/price")
.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}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.deapi.ai/api/v2/embeddings/price")
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}"
response = http.request(request)
puts response.read_body{
"data": {
"price": 0.0003
}
}{
"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."
}Estimate the cost of an embedding job before submitting it.
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Headers
Available options:
application/json Body
application/json
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.
Example:
"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.
Example:
"Bge_M3_FP16"
Response
Calculated price for txt2embedding inference.
Show child attributes
Show child attributes
Was this page helpful?
⌘I