# Debug Pricing

## Understanding How the Debug Agent Works

The [**Debug Agent** ](/emobiq-ai/readme/debug-agent.md)is an AI-powered tool designed to help you identify and fix issues in your app quickly and efficiently. It allows you to:

* Inspect HTML, JavaScript, and API logic
* Identify bugs or misconfigurations
* Apply temporary or permanent fixes directly within the code using natural language
* Test changes in real time

When you interact with the Debug Agent, it processes your request and does it's best to complete your request.

{% hint style="info" %}
*Do note that AI still makes mistakes and it might take a few prompts to fix the issue. For more information on prompting you can refer to the* [*Debug Agent page*](/emobiq-ai/readme/debug-agent.md)
{% endhint %}

***

### How Is Usage Measured?

Each interaction with the Debug Agent consumes **tokens**, which represent the amount of data processed with each prompt.

#### Example Session:

12 Tokens: 40866 (prompt: 39415, completion: 1451) **Cost: 0.41** **Credits**

This means that during this debug session:

* The user provided a **prompt** of \~39,415 tokens (describing the issue and providing context)
* The agent generated a **response** of \~1,451 tokens (proposing or applying a fix)
* Total cost is calculated based on these tokens processed

{% hint style="info" %}
***Note:** Token usage depends on how much content is sent and generated during the session — including source code, error messages, and explanations.*
{% endhint %}

***

### Why Is There A Charge?

You are charged credits based on **token usage** during each debug session. Here's why:

* **AI processing requires resources**: Each debug task involves analysing code, understanding context, and generating accurate responses
* **Token-based billing ensures fairness**: You only pay for what you use — not for idle time or fixed hours
* **Efficient sessions = lower costs**: The more specific and clear your prompt, the fewer tokens needed to resolve the issue

You're not charged for:

* Previewing changes in UI-only mode
* Viewing documentation or sample guides
* Running tests that don’t involve AI reasoning

***

### Real-World Debugging Example

#### Issue:

After reviewing `service_orders.html` and `service_order_details.html`, the Debug Agent identified that the service order details page was failing due to an authentication error when making an API call.

#### Fix Applied:

The Debug Agent made the following corrections in `service_order_details.html`:

* Fixed incorrect usage of `btoa()` in the `getAuthToken()` function
* Updated the request body format from JSON object to URL-encoded form data
* Standardised the `Authorization` header capitalisation

These changes resolved the authentication failure and allowed the page to load correctly.

#### Result:

* Service order details now display properly
* User redirected correctly instead of being sent back to the main menu
* API calls now authenticate successfully


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.emobiq.com/emobiq-ai/readme/how-pricing-works-in-emobiq-ai/debug-pricing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
