Get model pricing
curl --request GET \
--url https://inference.magica.com/v1/models/{modelId}/pricing \
--header 'Authorization: Bearer <token>'import requests
url = "https://inference.magica.com/v1/models/{modelId}/pricing"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://inference.magica.com/v1/models/{modelId}/pricing', 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://inference.magica.com/v1/models/{modelId}/pricing",
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://inference.magica.com/v1/models/{modelId}/pricing"
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://inference.magica.com/v1/models/{modelId}/pricing")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://inference.magica.com/v1/models/{modelId}/pricing")
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{
"modelId": "<string>",
"estimatedCost": "<string>",
"costSummary": "<string>",
"pricingApproach": "<string>",
"pricingDetails": {},
"note": "<string>"
}Models
Get model pricing
Return pricing and credit cost details for a single model.
GET
/
v1
/
models
/
{modelId}
/
pricing
Get model pricing
curl --request GET \
--url https://inference.magica.com/v1/models/{modelId}/pricing \
--header 'Authorization: Bearer <token>'import requests
url = "https://inference.magica.com/v1/models/{modelId}/pricing"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://inference.magica.com/v1/models/{modelId}/pricing', 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://inference.magica.com/v1/models/{modelId}/pricing",
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://inference.magica.com/v1/models/{modelId}/pricing"
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://inference.magica.com/v1/models/{modelId}/pricing")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://inference.magica.com/v1/models/{modelId}/pricing")
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{
"modelId": "<string>",
"estimatedCost": "<string>",
"costSummary": "<string>",
"pricingApproach": "<string>",
"pricingDetails": {},
"note": "<string>"
}Returns pricing metadata for one model. The pricing payload is intentionally flexible because some models expose fixed pricing and others can produce an exact estimate only when you include sample input.
Use this endpoint before expensive, dynamic, or user-controlled generations: long videos, large batches, high-resolution renders, long narration, or any flow where you want to show cost before spending credits. For a final pre-run estimate of one or more node payloads, use
POST /v1/nodes/estimate-credits.
Authorization
Path parameters
Model ID or sub-model ID from
GET /v1/models, such as
nano-banana-pro-text.Query parameters
Optional URL-encoded JSON object representing the model input. Build it from
fields returned by
GET /v1/models/{modelId} /schema. When supplied and supported by
the pricing model, the response includes an exact estimatedCost. If the
sample contains unsupported option values, the response explains what to fix
instead of quoting a fallback cost.Request
Always JSON-encode and URL-encodesampleInput; do not send raw { / } characters in the URL.
- cURL
- Node.js
- Python
curl "https://inference.magica.com/v1/models/nano-banana-pro-text/pricing?sampleInput=%7B%22prompt%22%3A%22studio%20product%20photo%22%7D" \
-H "Authorization: Bearer $MAGICA_API_KEY"
const modelId = "nano-banana-pro-text";
const sampleInput = encodeURIComponent(
JSON.stringify({ prompt: "studio product photo" }),
);
const res = await fetch(
`https://inference.magica.com/v1/models/${modelId}/pricing?sampleInput=${sampleInput}`,
{ headers: { Authorization: `Bearer ${process.env.MAGICA_API_KEY}` } },
);
const pricing = await res.json();
import json, os, requests
res = requests.get(
"https://inference.magica.com/v1/models/nano-banana-pro-text/pricing",
params={"sampleInput": json.dumps({"prompt": "studio product photo"})},
headers={"Authorization": f"Bearer {os.environ['MAGICA_API_KEY']}"},
)
pricing = res.json()
Response
Returns a model-specific pricing object. The exact shape depends on the model’s pricing strategy, so handle fields defensively.Present when
sampleInput was sufficient for an exact quote. Formatted in
credits, for example "2.50M".Present when there is no exact
estimatedCost. Human-readable pricing
summary, such as fixed, tiered, variable, or usage-based pricing.Programmatic pricing configuration. Common
type values include fixed,
tiered, per_second, per_minute, per_character, per_megapixel, and
variable.Guidance about whether an exact estimate was computed, whether
sampleInput
needs to be corrected, or whether the model settles credits after execution.Returned in the response body when pricing cannot be resolved for the model.
Treat this as an unknown model ID and rediscover IDs from the model
list/search endpoints.
Response example — exact estimate
{
"modelId": "nano-banana-pro-text",
"estimatedCost": "0.195M",
"note": "Estimated from the provided sampleInput. Credits are checked and charged automatically when you run the model."
}
Response example — pricing structure
{
"modelId": "example-video-model",
"costSummary": "tiered pricing",
"pricingApproach": "Tiered pricing based on duration + resolution. Pass sampleInput to get the exact estimatedCost.",
"pricingDetails": {
"type": "tiered",
"pricingInputs": ["duration", "resolution"]
},
"note": "Pass sampleInput to get an estimatedCost value. Credits are checked and charged automatically when you run the model."
}
Errors
| Status | Reason |
|---|---|
400 | sampleInput is present but is not valid JSON |
401 | Missing or invalid API key |
429 | API key rate limit exceeded |
200 with error | Unknown model ID returned by pricing lookup |
500 | Server error while resolving pricing |
Estimate semantics
Use the returned pricing metadata and model schema for current options and pricing rules. Estimates based on defaults or unavailable media information can differ from the final charge. Display returned credit amounts directly; do not apply an additional platform multiplier.Authorizations
Query Parameters
Was this page helpful?