Skip to main content
POST
/
api
/
v1
/
runtime
/
v1
/
embeddings
Generate embeddings
curl --request POST \
  --url https://api.runflow.ai/api/v1/runtime/v1/embeddings \
  --header 'Content-Type: application/json' \
  --data '
{
  "input": [
    "Hello, world!",
    "How are you?"
  ],
  "model": "text-embedding-3-small",
  "provider": "openai",
  "providerName": "My OpenAI Production",
  "dimensions": 1536
}
'
import requests

url = "https://api.runflow.ai/api/v1/runtime/v1/embeddings"

payload = {
"input": ["Hello, world!", "How are you?"],
"model": "text-embedding-3-small",
"provider": "openai",
"providerName": "My OpenAI Production",
"dimensions": 1536
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
input: ['Hello, world!', 'How are you?'],
model: 'text-embedding-3-small',
provider: 'openai',
providerName: 'My OpenAI Production',
dimensions: 1536
})
};

fetch('https://api.runflow.ai/api/v1/runtime/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.runflow.ai/api/v1/runtime/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' => [
'Hello, world!',
'How are you?'
],
'model' => 'text-embedding-3-small',
'provider' => 'openai',
'providerName' => 'My OpenAI Production',
'dimensions' => 1536
]),
CURLOPT_HTTPHEADER => [
"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.runflow.ai/api/v1/runtime/v1/embeddings"

payload := strings.NewReader("{\n \"input\": [\n \"Hello, world!\",\n \"How are you?\"\n ],\n \"model\": \"text-embedding-3-small\",\n \"provider\": \"openai\",\n \"providerName\": \"My OpenAI Production\",\n \"dimensions\": 1536\n}")

req, _ := http.NewRequest("POST", url, payload)

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.runflow.ai/api/v1/runtime/v1/embeddings")
.header("Content-Type", "application/json")
.body("{\n \"input\": [\n \"Hello, world!\",\n \"How are you?\"\n ],\n \"model\": \"text-embedding-3-small\",\n \"provider\": \"openai\",\n \"providerName\": \"My OpenAI Production\",\n \"dimensions\": 1536\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.runflow.ai/api/v1/runtime/v1/embeddings")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"input\": [\n \"Hello, world!\",\n \"How are you?\"\n ],\n \"model\": \"text-embedding-3-small\",\n \"provider\": \"openai\",\n \"providerName\": \"My OpenAI Production\",\n \"dimensions\": 1536\n}"

response = http.request(request)
puts response.read_body

Body

application/json
input
string[]
required

Array of texts to generate embeddings for

Example:
["Hello, world!", "How are you?"]
model
string
default:text-embedding-3-small

Embeddings model

Example:

"text-embedding-3-small"

provider
enum<string>
default:openai

Embeddings provider

Available options:
openai,
azure_openai,
cohere
providerName
string

Provider name (configured in LLM Providers) for credential resolution

Example:

"My OpenAI Production"

dimensions
number

Embedding dimensions (only for models that support it)

Example:

1536

Response

Embeddings generated successfully