Estimate the cost, in qBraid credits, of running a job on a device before submitting it.

The quote is a guide, not a cap. When you submit a job, its estimated cost is held from your credit balance; when the job finishes, you are charged its actual cost and the difference is refunded or debited. A job that runs longer than quoted is billed for what it used. A QPU is quoted from that device's execution history. A simulator is quoted from a fixed conservative duration, so its quote does not change with the shot count.

A device whose pricing cannot be quoted is a state, not an error: the response has pricingAvailable: false and a reason.

Args:

  • deviceQrn (string): Device QRN (qBraid Resource Name)
  • shots (integer, optional): Shot count to quote for. Defaults to 1000.

Returns:

  • A quote with estimatedCost when pricingAvailable is true, or a reason when it is false

Raises:

  • 400: deviceQrn is missing or shots is outside 1 to 100000
  • 403: You do not have device execution permission for this device
  • 404: Device is not found
  • 410: Device is retired
GET/jobs/cost-estimate

Authorizations

X-API-KEYstringheaderrequired

Authenticate requests using an API key linked to your qBraid account. Obtain your key by registering or logging in at account.qbraid.com.

Query Parameters

deviceQrnstringrequired

Device to quote

shotsintegerdefault: 1000

Shot count to quote for. Defaults to 1000.

Response

200Successful Response
successbooleanrequired
dataobjectrequired

A quote for a device with usable pricing

400Bad Request
403Forbidden
404Device Not Found
410Device Retired
Estimate Job Cost
curl --request GET \
  --url 'https://api-v2.qbraid.com/api/v1/jobs/cost-estimate?deviceQrn=<deviceQrn>' \
  --header 'X-API-KEY: <api-key>'
import requests

url = "https://api-v2.qbraid.com/api/v1/jobs/cost-estimate?deviceQrn=<deviceQrn>"
headers = {
    "X-API-KEY": "<api-key>"
}

response = requests.get(url, headers=headers)
print(response.json())
const url = "https://api-v2.qbraid.com/api/v1/jobs/cost-estimate?deviceQrn=<deviceQrn>";
const options = {
  method: "GET",
  headers: {"X-API-KEY":"<api-key>"},
};

const response = await fetch(url, options);
console.log(await response.json());
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api-v2.qbraid.com/api/v1/jobs/cost-estimate?deviceQrn=<deviceQrn>",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "X-API-KEY: <api-key>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	url := "https://api-v2.qbraid.com/api/v1/jobs/cost-estimate?deviceQrn=<deviceQrn>"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("X-API-KEY", "<api-key>")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))
}
HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://api-v2.qbraid.com/api/v1/jobs/cost-estimate?deviceQrn=<deviceQrn>"))
    .header("X-API-KEY", "<api-key>")
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
require 'uri'
require 'net/http'

url = URI("https://api-v2.qbraid.com/api/v1/jobs/cost-estimate?deviceQrn=<deviceQrn>")

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

request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'

response = http.request(request)
puts response.read_body
{
  "success": true,
  "data": {
    "pricingAvailable": true,
    "estimatedCost": 123,
    "deviceQrn": "<string>",
    "shots": 123
  }
}
{
  "success": false,
  "message": "Query validation failed: shots: shots must be at least 1"
}
{
  "success": false,
  "message": "Missing device execution permission for: aws:aqt:qpu:ibex-q1"
}
{
  "success": false,
  "message": "Device not found: does:not:exist:nope"
}
{
  "success": false,
  "message": "Device is retired and no longer available: aws:aws:sim:tn1"
}