Estimate image credits
curl --request GET \
--url https://api.magichour.ai/v1/estimate/image \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.magichour.ai/v1/estimate/image"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.magichour.ai/v1/estimate/image', 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.magichour.ai/v1/estimate/image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.magichour.ai/v1/estimate/image"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.magichour.ai/v1/estimate/image")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magichour.ai/v1/estimate/image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"estimated_credits": 150
}{
"code": "invalid_request",
"message": "<string>"
}{
"code": "unauthorized",
"message": "<string>"
}{
"code": "unprocessable_entity",
"message": "<string>"
}{
"code": "internal_server_error",
"message": "<string>"
}Image Projects
Estimate image credits
Get the credits an image create request charges. Pass tool, then the fields below that the tool’s create request uses, with the same values. Does not create a project or spend credits. It prices the fields passed here. It does not check your plan, your balance or the rest of the create request.
GET
/
v1
/
estimate
/
image
Estimate image credits
curl --request GET \
--url https://api.magichour.ai/v1/estimate/image \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.magichour.ai/v1/estimate/image"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.magichour.ai/v1/estimate/image', 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.magichour.ai/v1/estimate/image",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.magichour.ai/v1/estimate/image"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.magichour.ai/v1/estimate/image")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.magichour.ai/v1/estimate/image")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"estimated_credits": 150
}{
"code": "invalid_request",
"message": "<string>"
}{
"code": "unauthorized",
"message": "<string>"
}{
"code": "unprocessable_entity",
"message": "<string>"
}{
"code": "internal_server_error",
"message": "<string>"
}Authorizations
Bearer authentication header of the form Bearer <api_key>, where <api_key> is your API key. To get your API key, go to Developer Hub and click "Create new API Key".
Query Parameters
The create endpoint to price, named by its path. For example ai-image-editor for POST /v1/ai-image-editor.
Available options:
ai-image-generator, ai-image-editor, ai-image-upscaler, body-swap, head-swap, face-swap-photo, ai-clothes-changer, ai-face-editor, ai-gif-generator, ai-headshot-generator, ai-meme-generator, ai-qr-code-generator, image-background-remover, photo-colorizer Example:
"ai-image-editor"
Was this page helpful?