Estimate a generation's cost
curl --request POST \
--url https://hub.oxen.ai/api/ai/models/{id}/estimate \
--header 'Content-Type: application/json' \
--data '
{
"input_image_height": 32768,
"input_image_width": 32768,
"input_video_seconds": 1,
"num_generations": 1,
"params": {}
}
'import requests
url = "https://hub.oxen.ai/api/ai/models/{id}/estimate"
payload = {
"input_image_height": 32768,
"input_image_width": 32768,
"input_video_seconds": 1,
"num_generations": 1,
"params": {}
}
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_image_height: 32768,
input_image_width: 32768,
input_video_seconds: 1,
num_generations: 1,
params: {}
})
};
fetch('https://hub.oxen.ai/api/ai/models/{id}/estimate', 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://hub.oxen.ai/api/ai/models/{id}/estimate",
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_image_height' => 32768,
'input_image_width' => 32768,
'input_video_seconds' => 1,
'num_generations' => 1,
'params' => [
]
]),
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://hub.oxen.ai/api/ai/models/{id}/estimate"
payload := strings.NewReader("{\n \"input_image_height\": 32768,\n \"input_image_width\": 32768,\n \"input_video_seconds\": 1,\n \"num_generations\": 1,\n \"params\": {}\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://hub.oxen.ai/api/ai/models/{id}/estimate")
.header("Content-Type", "application/json")
.body("{\n \"input_image_height\": 32768,\n \"input_image_width\": 32768,\n \"input_video_seconds\": 1,\n \"num_generations\": 1,\n \"params\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hub.oxen.ai/api/ai/models/{id}/estimate")
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_image_height\": 32768,\n \"input_image_width\": 32768,\n \"input_video_seconds\": 1,\n \"num_generations\": 1,\n \"params\": {}\n}"
response = http.request(request)
puts response.read_body{
"estimate": {
"kind": "exact",
"label": "<string>",
"max_usd": "<string>",
"min_usd": "<string>",
"note": "<string>",
"rates": [
{
"per": "<string>",
"usd": "<string>"
}
]
},
"model": "<string>"
}{}{}API Reference
Estimate a generation's cost
Estimates what a generation with these parameters would cost, from the same pricing that bills it. kind is exact, range (the parameters leave the length or size open), rate (billed by usage only known after the run; see rates) or unknown. The final charge is always computed from the run’s actual usage.
POST
/
api
/
ai
/
models
/
{id}
/
estimate
Estimate a generation's cost
curl --request POST \
--url https://hub.oxen.ai/api/ai/models/{id}/estimate \
--header 'Content-Type: application/json' \
--data '
{
"input_image_height": 32768,
"input_image_width": 32768,
"input_video_seconds": 1,
"num_generations": 1,
"params": {}
}
'import requests
url = "https://hub.oxen.ai/api/ai/models/{id}/estimate"
payload = {
"input_image_height": 32768,
"input_image_width": 32768,
"input_video_seconds": 1,
"num_generations": 1,
"params": {}
}
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_image_height: 32768,
input_image_width: 32768,
input_video_seconds: 1,
num_generations: 1,
params: {}
})
};
fetch('https://hub.oxen.ai/api/ai/models/{id}/estimate', 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://hub.oxen.ai/api/ai/models/{id}/estimate",
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_image_height' => 32768,
'input_image_width' => 32768,
'input_video_seconds' => 1,
'num_generations' => 1,
'params' => [
]
]),
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://hub.oxen.ai/api/ai/models/{id}/estimate"
payload := strings.NewReader("{\n \"input_image_height\": 32768,\n \"input_image_width\": 32768,\n \"input_video_seconds\": 1,\n \"num_generations\": 1,\n \"params\": {}\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://hub.oxen.ai/api/ai/models/{id}/estimate")
.header("Content-Type", "application/json")
.body("{\n \"input_image_height\": 32768,\n \"input_image_width\": 32768,\n \"input_video_seconds\": 1,\n \"num_generations\": 1,\n \"params\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://hub.oxen.ai/api/ai/models/{id}/estimate")
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_image_height\": 32768,\n \"input_image_width\": 32768,\n \"input_video_seconds\": 1,\n \"num_generations\": 1,\n \"params\": {}\n}"
response = http.request(request)
puts response.read_body{
"estimate": {
"kind": "exact",
"label": "<string>",
"max_usd": "<string>",
"min_usd": "<string>",
"note": "<string>",
"rates": [
{
"per": "<string>",
"usd": "<string>"
}
]
},
"model": "<string>"
}{}{}Path Parameters
Model ID (UUID) or name
Body
application/json
Estimate request
Height in pixels of the input image
Required range:
1 <= x <= 65535Width in pixels of the input image; with input_image_height, prices an image model billed by output size exactly
Required range:
1 <= x <= 65535Length of the longest input video; prices a video edit, which runs at that length
Required range:
x >= 0Required range:
1 <= x <= 100The model's request parameters, per its json_request_schema