Embeddings
curl --request POST \
--url https://app.frogbot.ai/api/v1/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": {},
"encoding_format": "<string>",
"dimensions": 123
}
'import requests
url = "https://app.frogbot.ai/api/v1/embeddings"
payload = {
"model": "<string>",
"input": {},
"encoding_format": "<string>",
"dimensions": 123
}
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: '<string>', input: {}, encoding_format: '<string>', dimensions: 123})
};
fetch('https://app.frogbot.ai/api/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://app.frogbot.ai/api/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' => '<string>',
'input' => [
],
'encoding_format' => '<string>',
'dimensions' => 123
]),
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://app.frogbot.ai/api/v1/embeddings"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": {},\n \"encoding_format\": \"<string>\",\n \"dimensions\": 123\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://app.frogbot.ai/api/v1/embeddings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"input\": {},\n \"encoding_format\": \"<string>\",\n \"dimensions\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.frogbot.ai/api/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 \"model\": \"<string>\",\n \"input\": {},\n \"encoding_format\": \"<string>\",\n \"dimensions\": 123\n}"
response = http.request(request)
puts response.read_body{
"object": "list",
"data": [
{
"index": 0,
"object": "embedding",
"embedding": [0.0023064255, -0.009327292, 0.015797347]
}
],
"model": "text-embedding-3-small",
"usage": {
"prompt_tokens": 9,
"total_tokens": 9
}
}
Inference API
Embeddings
Generate vector embeddings from text
POST
/
api
/
v1
/
embeddings
Embeddings
curl --request POST \
--url https://app.frogbot.ai/api/v1/embeddings \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"input": {},
"encoding_format": "<string>",
"dimensions": 123
}
'import requests
url = "https://app.frogbot.ai/api/v1/embeddings"
payload = {
"model": "<string>",
"input": {},
"encoding_format": "<string>",
"dimensions": 123
}
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: '<string>', input: {}, encoding_format: '<string>', dimensions: 123})
};
fetch('https://app.frogbot.ai/api/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://app.frogbot.ai/api/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' => '<string>',
'input' => [
],
'encoding_format' => '<string>',
'dimensions' => 123
]),
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://app.frogbot.ai/api/v1/embeddings"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"input\": {},\n \"encoding_format\": \"<string>\",\n \"dimensions\": 123\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://app.frogbot.ai/api/v1/embeddings")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"input\": {},\n \"encoding_format\": \"<string>\",\n \"dimensions\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.frogbot.ai/api/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 \"model\": \"<string>\",\n \"input\": {},\n \"encoding_format\": \"<string>\",\n \"dimensions\": 123\n}"
response = http.request(request)
puts response.read_body{
"object": "list",
"data": [
{
"index": 0,
"object": "embedding",
"embedding": [0.0023064255, -0.009327292, 0.015797347]
}
],
"model": "text-embedding-3-small",
"usage": {
"prompt_tokens": 9,
"total_tokens": 9
}
}
Create an embedding vector from a text input. Compatible with the OpenAI embeddings API.
Authenticate
Use an API key in theAuthorization header.
curl https://app.frogbot.ai/api/v1/embeddings \
-H "Authorization: Bearer $FROGBOT_API_KEY"
Request body
string
required
Embedding model ID to use. See available embedding models for the full list.Examples:
text-embedding-3-small, text-embedding-3-large, voyage-4, voyage-4-largestring | array
required
Text to embed. Pass a string for a single input or an array of strings for batch embedding.
["The quick brown fox", "jumped over the lazy dog"]
string
default:"float"
Format for the returned embeddings. Options:
float, base64.integer
Number of dimensions for the output embedding. Supported on
text-embedding-3-small and text-embedding-3-large.Response
string
Always
list.array
string
The model used to generate the embeddings.
object
Examples
curl https://app.frogbot.ai/api/v1/embeddings \
-H "Authorization: Bearer $FROGBOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "text-embedding-3-small",
"input": "The quick brown fox jumped over the lazy dog"
}'
curl https://app.frogbot.ai/api/v1/embeddings \
-H "Authorization: Bearer $FROGBOT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "voyage-4",
"input": ["First document", "Second document", "Third document"]
}'
from openai import OpenAI
client = OpenAI(
base_url="https://app.frogbot.ai/api/v1",
api_key="YOUR_API_KEY"
)
response = client.embeddings.create(
model="text-embedding-3-small",
input="The quick brown fox jumped over the lazy dog"
)
print(response.data[0].embedding)
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://app.frogbot.ai/api/v1",
apiKey: "YOUR_API_KEY",
});
const response = await client.embeddings.create({
model: "text-embedding-3-small",
input: "The quick brown fox jumped over the lazy dog",
});
console.log(response.data[0].embedding);
{
"object": "list",
"data": [
{
"index": 0,
"object": "embedding",
"embedding": [0.0023064255, -0.009327292, 0.015797347]
}
],
"model": "text-embedding-3-small",
"usage": {
"prompt_tokens": 9,
"total_tokens": 9
}
}