> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ionq.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Job Cost and Usage

> Estimate job cost and track credit usage.

Our compute pricing model covers direct access to our commercially available quantum computers, including Forte and Forte Enterprise systems. If you are accessing IonQ systems via a partner, the information on this page may not apply directly - please refer to the documentation provided by that platform.

Jobs run on IonQ QPUs consume **compute credit** based on the job size. Compute credit is reserved when a job is submitted and charged when the job is run; reserved credit is released (not charged) if a job fails or is canceled. A job will fail if either the project budget and organization balance has insufficient compute credit.

Compute credit may be displayed as Credits or USD, depending on the configuration for your specific organization, but the tools and processes discussed here are applicable for any direct IonQ access.

## Estimating job cost

Any quantum circuit run on an IonQ QPU will consume an amount of compute credit. The credit used by a job is subtracted from the available project budget and organization balance when the job runs.

Your particular rates, credit units, and cost model may vary depending on your access agreement with IonQ - please reach out to [support@ionq.com](mailto:support@ionq.com) if you have specific questions regarding job cost. All calculations are estimates only and are not binding on either you or IonQ; your actual job costs may be higher or lower than these estimates.

### From gate and shot counts

Job cost can be estimated via the [/jobs/estimate](/api-reference/v0.4/jobs/get-job-estimate) API endpoint, which uses your API key to select the correct rate and cost model for your organization. Depending on your organization's specific cost model, the level of uncertainty in this estimate may vary. In general, actual job costs may not exactly reflect these estimates.

This estimator uses the number of one-qubit gate operations (1Q gates) and two-qubit gate operations (2Q gates) in the circuit, along with the number of shots. For gates with 3 or more qubits, use the formula 6(N-2) to express an N-qubit gate as an equivalent number of 2Q gates before running the estimation.

In Python, an example API request for this job cost estimator would look like:

```python theme={null}
import os
import requests

# Define values for estimation
estimate = {
    "backend": "qpu.forte-enterprise-1",
    "qubits": 25,
    "shots": 1000,
    "1q_gates": 400,
    "2q_gates": 150,
    "error_mitigation": True
}

# Set up authorization (assuming API key stored as environment variable)
headers = {"Authorization": f"apiKey {os.getenv('IONQ_API_KEY')}"}

# Submit request
response = requests.get(
    url,
    headers=headers,
    params=estimate
)

# Print the estimated cost from the response
print(response.json().get("estimated_cost"))
```

Here, the cost estimate at IonQ's standard rates comes to `233.75`.

In addition to the estimated cost, the full response output also specifies the cost units (USD in this example) and includes a record of the input parameters, along with the time the estimate was performed, the organization and its rate information, and estimated execution and queue time.

You can also run this estimator within our API docs [here](https://docs.ionq.com/api-reference/v0.4/jobs/get-job-estimate?playground=open) or by clicking "Try it" on the [Get job estimate](https://docs.ionq.com/api-reference/v0.4/jobs/get-job-estimate) page. You'll need to generate or copy an API key and paste `apiKey abc123` (where `abc123` is your API key) in the "Authorization" box, then enter the parameters for your estimate and click "Send".

In some cases, there is a minimum per-circuit cost. For small jobs within a certain size range, the cost will always be rounded up to this minimum value. Above this range, the cost will increase when increasing the number of gates or shots. Note that this minimum value is different for jobs run with or without [debiasing, our built-in error mitigation](/guides/error-mitigation-debiasing), which is enabled by default for jobs with 500 or more shots. The job size threshold and minimum cost are lower when debiasing is turned off, so turning off debiasing may reduce job cost for jobs in a certain size range. For larger jobs, however, debiasing will not affect the cost.

In some cases, the cost for a specific circuit may be significantly lower or higher than the estimate from this tool, based on the efficiency of circuit transpilation and optimization. For a more accurate, circuit-specific estimate, we recommend using dry-run jobs to predict cost, as described below.

### Predicting cost via dry-run jobs

If you have already built your quantum circuits or run jobs on IonQ's cloud simulators, submitting a dry-run job to an IonQ QPU is recommended for cost estimation as well as general debugging. A dry-run job will pass through our usual compilation process and all preflight checks and calculations, but it will not enter the queue or be executed on a QPU.

To submit a dry-run job via the IonQ Quantum Cloud API v0.4, include `"dry_run": True` in the job request data.

For `qiskit-ionq` v1.0.3 and later, you can include `dry_run=True` in your `backend.run()` call.

For `qiskit-ionq` v1.0.2 and earlier, include `extra_query_params={'dry_run': True'}` in your `backend.run()` call.

<Warning>Using `dry_run=True` is *not* backwards-compatible. If you pass this argument when using `qiskit-ionq` \<1.0.3, it will be ignored and your submission will be treated as a normal QPU job (including execution on QPU and consumption of credit). Make sure to use `extra_query_params` instead with older versions of this package.</Warning>

For `qiskit-ionq` versions prior to 0.6.1, dry-run functionality is not available.

<CodeGroup>
  ```python qiskit-ionq >=1.0.3 theme={null}
  job = backend.run(
      qc,
      shots=1000,
      dry_run=True
  )
  ```

  ```python qiskit-ionq <=1.0.2 theme={null}
  job = backend.run(
      qc,
      shots=1000,
      extra_query_params={'dry_run': True}
  )
  ```
</CodeGroup>

Currently, the predicted job cost information cannot be retrieved directly via Qiskit, but you can access the predicted cost via the IonQ API for a dry-run job submitted via any method, using the [get job cost](/api-reference/v0.4/jobs/get-job-cost) endpoint.

In Python, with your API key stored as an environment variable named `IONQ_API_KEY`, this looks like:

```python Get job cost theme={null}
import requests
import os

# Take the job ID from your completed dry-run job
job_id = "..."

# Set up authentication
# Paste your API key in "apiKey your-key-here" if it's not in an environment variable
headers = {"Authorization": f"apiKey {os.getenv('IONQ_API_KEY')}"}

# Submit the request
response = requests.get(
    url=f"https://api.ionq.co/v0.4/jobs/{job_id}/cost",
    headers=headers
)

# Print the response
print(response.json())
```

The response will contain the estimated cost unit and value, like:

```json theme={null}
{
    'dry_run': True,
    'estimated_cost': {
        'unit': 'usd',
        'value': 168.2
    }
}
```

You can also retrieve the cost for non-dry-run jobs in the same way. Queued jobs will display the estimated cost, and completed QPU jobs will display the estimated and actual cost.

The dry-run job cost is also displayed in the IonQ Cloud Console UI. While dry-run jobs will show `completed` status and cost, this cost has *not* been charged and is not counted towards the project or organization-level usage. Similarly, failed and canceled jobs may display predicted costs, but these costs are not charged.

### Other job types

For multicircuit jobs, the total cost is the sum of individual child circuit job costs.

For quantum-function jobs, the cost is the sum of individual circuit jobs spawned by the quantum function.

For jobs run during billable reservations, the individual job cost will show as zero, but there is a separate charge for the reserved time.

## Budget and quota errors

If you submit a job and receive `QuotaExhaustedError` with an error message like: "Budget exhausted for project with ID ..." or "Exhausted spending quota of type: project", the predicted cost of the job exceeds the amount of available credit in the project where the job was submitted.

If the predicted cost of the job appears to be smaller than the amount of credit available to the project, check whether there are other queued ("ready") jobs in the project. Credit is reserved for these jobs when they are submitted, and the check for available credit considers this amount as unavailable for additional job submissions. Canceling queued jobs will free up their reserved credit.

In general, if you receive an error related to your project budget, you may need to reduce the job size (and cost) or ask your organization admin to increase your project budget.

Less commonly, you may receive a similar error regarding your *organization* budget. This may occur even if your project budget indicates that sufficient compute credit is available. If you are an organization admin, you may view the available credit on the Organization Spend page, including the timeline for issuance and expiration of any additional credit, if applicable. Note that users cannot view the organization-level credit information directly.

## Tracking usage

The IonQ Cloud Console provides several ways of viewing and tracking credit usage.

### My Jobs

Each user can see their job costs (including predicted costs for dry-run, queued, failed, and canceled jobs) on the [Jobs page](https://cloud.ionq.com/jobs). This information can also be filtered and exported.

### Projects

On the [Projects](https://cloud.ionq.com/projects) page, users can see the total cost (for completed QPU jobs) and budget limit for their projects. Organization admins can see this information for all projects in their organization.

Clicking into a project also shows a visualization of the total project job cost relative to the budget limit, as well as a table of jobs in the project (which can be filtered and exported). The members list on a project also shows the total cost of jobs run by each project member.

Note that project cost and project-level metrics reflect *lifetime usage* over the entire existence of the project.

For more information about projects, see our [user manual](/user-manual/projects).

### Organization reporting

Organization admins can access the Reporting page (click "Settings" in the Cloud Console menu to expand the organization-level settings and tools). This page displays credit usage by project or job, over time.

Admins can switch between viewing project and job-level breakdowns, choose monthly or weekly tracking, and adjust the date range for the report. Each week or month shows the top three jobs or projects (if applicable) followed by the combined cost of all other jobs or projects. Below the graph, more information about the number of jobs and usage by specific projects is available.

### Organization spend

Organization admins can also view [the Spend page for their organization](/user-manual/organizations#organization-spend).

For an organization with an active IonQ contract, this will display individual credit grants associated with the contract, including status, value, active period, and usage. This information will reflect your specific credit expiration schedule. Please reach out to your IonQ point of contact with specific questions.

For other organizations, this page will display information about prepaid credit you have purchased directly, if applicable.
