Python
from openai import OpenAI
client = OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key",
)
response = client.embeddings.create(
input=["text to embed"],
model="E5-Mistral-7B-Instruct",
)
print(response.data[0].embedding)curl -X POST https://api.infercom.ai/v1/embeddings \
-H "Authorization: Bearer $INFERCOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": ["text to embed"],
"model": "E5-Mistral-7B-Instruct"
}'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input: ['text to embed number 1', 'text to embed number 2'],
model: 'E5-Mistral-7B-Instruct'
})
};
fetch('https://api.infercom.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.infercom.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([
'input' => [
'text to embed number 1',
'text to embed number 2'
],
'model' => 'E5-Mistral-7B-Instruct'
]),
CURLOPT_HTTPHEADER => [
"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.infercom.ai/v1/embeddings"
payload := strings.NewReader("{\n \"input\": [\n \"text to embed number 1\",\n \"text to embed number 2\"\n ],\n \"model\": \"E5-Mistral-7B-Instruct\"\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))
}HttpResponse<String> response = Unirest.post("https://api.infercom.ai/v1/embeddings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": [\n \"text to embed number 1\",\n \"text to embed number 2\"\n ],\n \"model\": \"E5-Mistral-7B-Instruct\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.infercom.ai/v1/embeddings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": [\n \"text to embed number 1\",\n \"text to embed number 2\"\n ],\n \"model\": \"E5-Mistral-7B-Instruct\"\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"index": 0,
"object": "embedding",
"embedding": [
0.024864232167601585,
-0.01452154759317636,
0.008880083449184895
]
},
{
"index": 1,
"object": "embedding",
"embedding": [
0.010919672437012196,
0.0016351072117686272,
0.008019134402275085
]
}
],
"model": "E5-Mistral-7B-Instruct",
"object": "list",
"usage": {
"prompt_tokens": 716,
"total_tokens": 716
}
}"Invalid request body: - missing property 'model'\"""unauthorized"{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"param": "<string>",
"type": "<string>"
}
}"<string>""Service Temporarily Unavailable"Embeddings
Create embeddings
Generate vector embeddings for input text. Note: This endpoint requires an embedding model to be available. Check GET /v1/models for current model availability.
POST
/
embeddings
Python
from openai import OpenAI
client = OpenAI(
base_url="https://api.infercom.ai/v1",
api_key="your-infercom-api-key",
)
response = client.embeddings.create(
input=["text to embed"],
model="E5-Mistral-7B-Instruct",
)
print(response.data[0].embedding)curl -X POST https://api.infercom.ai/v1/embeddings \
-H "Authorization: Bearer $INFERCOM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": ["text to embed"],
"model": "E5-Mistral-7B-Instruct"
}'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input: ['text to embed number 1', 'text to embed number 2'],
model: 'E5-Mistral-7B-Instruct'
})
};
fetch('https://api.infercom.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.infercom.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([
'input' => [
'text to embed number 1',
'text to embed number 2'
],
'model' => 'E5-Mistral-7B-Instruct'
]),
CURLOPT_HTTPHEADER => [
"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.infercom.ai/v1/embeddings"
payload := strings.NewReader("{\n \"input\": [\n \"text to embed number 1\",\n \"text to embed number 2\"\n ],\n \"model\": \"E5-Mistral-7B-Instruct\"\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))
}HttpResponse<String> response = Unirest.post("https://api.infercom.ai/v1/embeddings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"input\": [\n \"text to embed number 1\",\n \"text to embed number 2\"\n ],\n \"model\": \"E5-Mistral-7B-Instruct\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.infercom.ai/v1/embeddings")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": [\n \"text to embed number 1\",\n \"text to embed number 2\"\n ],\n \"model\": \"E5-Mistral-7B-Instruct\"\n}"
response = http.request(request)
puts response.read_body{
"data": [
{
"index": 0,
"object": "embedding",
"embedding": [
0.024864232167601585,
-0.01452154759317636,
0.008880083449184895
]
},
{
"index": 1,
"object": "embedding",
"embedding": [
0.010919672437012196,
0.0016351072117686272,
0.008019134402275085
]
}
],
"model": "E5-Mistral-7B-Instruct",
"object": "list",
"usage": {
"prompt_tokens": 716,
"total_tokens": 716
}
}"Invalid request body: - missing property 'model'\"""unauthorized"{
"error": "<string>"
}{
"error": "<string>"
}{
"error": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>",
"param": "<string>",
"type": "<string>"
}
}"<string>""Service Temporarily Unavailable"Authorizations
Infercom API Key
Body
application/json
Texts to embed and parameters
Response
Successful response
Embeddings response returned by the model
The object type, which is always "list".
Available options:
list The name of the model used to generate the embedding.
Usage metrics for the completion, embeddings,transcription or translation request
Show child attributes
Show child attributes
Examples:
{ "acceptance_rate": 4.058139324188232, "completion_tokens": 350, "completion_tokens_after_first_per_sec": 248.09314856382406, "completion_tokens_after_first_per_sec_first_ten": 249.67922929952655, "completion_tokens_after_first_per_sec_graph": 452.5030493415834, "completion_tokens_per_sec": 238.91966176995348, "end_time": 1737583289.7345645, "is_last_response": true, "prompt_tokens_details": { "cached_tokens": 0 }, "prompt_tokens": 43, "start_time": 1737583288.264706, "time_to_first_token": 0.06312894821166992, "total_latency": 1.4649275719174653, "total_tokens": 393, "total_tokens_per_sec": 268.27264878740493 }
{ "prompt_tokens": 43, "total_tokens": 393 }
The list of embeddings generated by the model.
Show child attributes
Show child attributes
⌘I