Create embeddings
curl --request POST \
--url https://api.infery.ai/v1/embeddings \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "text-embedding-3-small",
"input": "<string>",
"dimensions": 123
}
'import requests
url = "https://api.infery.ai/v1/embeddings"
payload = {
"model": "text-embedding-3-small",
"input": "<string>",
"dimensions": 123
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'text-embedding-3-small', input: '<string>', dimensions: 123})
};
fetch('https://api.infery.ai/v1/embeddings', 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.infery.ai/v1/embeddings",
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([
'model' => 'text-embedding-3-small',
'input' => '<string>',
'dimensions' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.infery.ai/v1/embeddings"
payload := strings.NewReader("{\n \"model\": \"text-embedding-3-small\",\n \"input\": \"<string>\",\n \"dimensions\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.infery.ai/v1/embeddings")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"text-embedding-3-small\",\n \"input\": \"<string>\",\n \"dimensions\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.infery.ai/v1/embeddings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"text-embedding-3-small\",\n \"input\": \"<string>\",\n \"dimensions\": 123\n}"
response = http.request(request)
puts response.read_body{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [
0.0023,
-0.0094,
0.0156
]
}
],
"model": "text-embedding-3-small",
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
},
"credits_used": 1
}{
"error": {
"message": "Model not found",
"type": "invalid_request_error",
"code": "model_not_found",
"param": "model"
}
}{
"error": {
"message": "Model not found",
"type": "invalid_request_error",
"code": "model_not_found",
"param": "model"
}
}{
"error": {
"message": "Model not found",
"type": "invalid_request_error",
"code": "model_not_found",
"param": "model"
}
}Embeddings
Embeddings
POST /v1/embeddings — dense vector embeddings for text.
POST
/
v1
/
embeddings
Create embeddings
curl --request POST \
--url https://api.infery.ai/v1/embeddings \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "text-embedding-3-small",
"input": "<string>",
"dimensions": 123
}
'import requests
url = "https://api.infery.ai/v1/embeddings"
payload = {
"model": "text-embedding-3-small",
"input": "<string>",
"dimensions": 123
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'text-embedding-3-small', input: '<string>', dimensions: 123})
};
fetch('https://api.infery.ai/v1/embeddings', 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.infery.ai/v1/embeddings",
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([
'model' => 'text-embedding-3-small',
'input' => '<string>',
'dimensions' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.infery.ai/v1/embeddings"
payload := strings.NewReader("{\n \"model\": \"text-embedding-3-small\",\n \"input\": \"<string>\",\n \"dimensions\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.infery.ai/v1/embeddings")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"text-embedding-3-small\",\n \"input\": \"<string>\",\n \"dimensions\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.infery.ai/v1/embeddings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"text-embedding-3-small\",\n \"input\": \"<string>\",\n \"dimensions\": 123\n}"
response = http.request(request)
puts response.read_body{
"object": "list",
"data": [
{
"object": "embedding",
"index": 0,
"embedding": [
0.0023,
-0.0094,
0.0156
]
}
],
"model": "text-embedding-3-small",
"usage": {
"prompt_tokens": 8,
"total_tokens": 8
},
"credits_used": 1
}{
"error": {
"message": "Model not found",
"type": "invalid_request_error",
"code": "model_not_found",
"param": "model"
}
}{
"error": {
"message": "Model not found",
"type": "invalid_request_error",
"code": "model_not_found",
"param": "model"
}
}{
"error": {
"message": "Model not found",
"type": "invalid_request_error",
"code": "model_not_found",
"param": "model"
}
}OpenAI-compatible embeddings endpoint.
Returns standard
curl https://api.infery.ai/v1/embeddings \
-H "Authorization: Bearer $INFERY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "text-embedding-3-small",
"input": "Dense vector, please"
}'
{ data: [{ embedding: [...], index: 0 }], usage: {...} }.
Supported models
Browse withGET /v1/models?modality=embedding or see Models. OpenAI, Google, Alibaba and open-source embedding models available.
Batching
input can be an array of up to 2 048 strings. Each string is a separate embedding; all share the same pricing.
Dimensionality reduction
On supported models (e.g.text-embedding-3-small, text-embedding-3-large):
{"model": "text-embedding-3-small", "input": "...", "dimensions": 512}
Authorizations
API key in format: Bearer inf_***
Headers
Optional request ID for tracking
Body
application/json
⌘I

