AI usage cost calculation

Defining a database is an iterative process that can require multiple rounds of refinement.

Every Fabricate action that calls an LLM contributes to your AI usage. Different types of actions can cost more or less, depending on their size and complexity.

Input and output tokens

Every request from Fabricate to the LLM - such as to create a database, change the data, or download data - incurs input tokens.

The response from the LLM - such as asking for clarification, creating tables, changing the data, or, creating visualizations - incurs output tokens.

Incurring input and output tokens for an AI request

AI usage costs based on request and response "turns"

Fabricate tracks the token cost for each conversation.

A conversation starts with an initial prompt and response. Based on the response, you might issue additional prompts to perform tasks such as changing the database structure, changing the data, or generating a visualization of the data.

Each additional exchange after the initial prompt is called a turn.

Tracking turns in an AI conversation

The token cost for an initial prompt or a turn increases with the complexity of the request. For example:

  • A very basic correction or visualization might cost around $0.17. As a rough estimate, the monthly AI usage allowance can cover just over 100 of these smaller tasks.

  • A more complex request, such as modifying a large schema across multiple tables, might cost around $0.37. The monthly AI usage allowance can cover roughly 60 of these larger tasks.

A highly complex task that contains multiple turns, where you go back and forth 7 times to arrive at the final result that you want, might cost around $2.60. The monthly AI usage allowance can cover roughly 9 of these very large tasks.

When Fabricate checks the available AI usage allowance

After each turn, Fabricate checks the remaining AI usage allowance for the current month.

If your account no longer has a remaining AI usage balance, then:

  • For Free plan accounts, Fabricate pauses access to AI features until the start of the next billing month, when the available AI usage is reset.

  • For Plus and Enterprise accounts, Fabricate begins to track the AI usage overage charges.

Examples of AI usage costs for different types of requests

Here are some examples of different types of conversations and their cost.

Each example shows:

  • The text of the user requests

  • The total input tokens for the conversation

  • The total output tokens for the conversation

  • The total AI usage cost for the conversation. The total cost includes the charge from the LLM as well as the Tonic.ai token fee.

Note that the token counts and usage cost roughly represent how similar requests might work. The examples are intended to help you to understand how the AI cost is calculated.

Simple generation

Step
Request prompt

Initial prompt

Create a CSV of 5,000 fake users. I need 5 columns: user_id (UUID), first_name, last_name, email, and a created_at timestamp from the last 6 months.

For this conversation:

Total input tokens
Total output tokens
Total cost

30,494

3,221

$0.17

Simple generation with a single iteration

Step
Request prompt

Initial prompt

Generate a list of 100 products with product_id, name, category, and price (between $10.00 and $100.00).

Turn 1

Actually, can you add a 'SKU' column with a random 8-character alphanumeric string?

For this conversation:

Total input tokens
Total output tokens
Total cost

65,637

4,754

$0.34

Simple generation with visualization

Step
Request prompt

Initial prompt

Generate 2,000 customer leads. Include name, email, and a 'country' column (options: USA, Canada, Mexico).

Turn 1

Can you visualize the distribution of the 'country' column for me in a bar chart?

For this conversation:

Total input tokens
Total output tokens
Total cost

77,851

3,231

$0.36

Complex generation

Step
Request prompt

Initial prompt

Create a relational dataset for an e-commerce store. I need 3 tables: 'Users' (user_id, name, email), 'Products' (product_id, name, price), and 'Orders' (order_id, user_id, product_id, quantity, order_date). Make sure user_id and product_id in 'Orders' are valid foreign keys.

For this conversation:

Total input tokens
Total output tokens
Total cost

91,212

5,346

$0.45

Complex generation with a few iterations

Step
Request prompt

Initial prompt

Create a relational dataset for an e-commerce store. I need 3 tables: 'Users' (user_id, name, email), 'Products' (product_id, name, price), and 'Orders' (order_id, user_id, product_id, quantity, order_date). Make sure user_id and product_id in 'Orders' are valid foreign keys.

Turn 1

This is a good start. Can you add a 'shipping_address' (street, city, zip, state) to the 'Users' table?

Turn 2

Also, add a 'category' (e.g., 'electronics', 'clothing') to the 'Products' table.

Turn 3

OK, now show me the first 5 rows from the 'Orders' table so I can validate it.

For this conversation:

Total input tokens
Total output tokens
Total cost

269,142

9,562

$1.23

Complex generation with several iterations

Step
Request prompt

Initial prompt

Create a synthetic patient database. I need patient_id, full_name, DOB, phone_number, and a 'diagnosis_code' in a valid ICD-10 format (e.g., J01.0, K21.9). All PII must be synthetic but look realistic (e.g., valid area codes for phone numbers).

Turn 1

The names look too generic. Can you use a wider variety of first and last names?

Turn 2

The diagnosis codes are too random. Can you make the distribution weighted? Make 'J01.0' 15% of records, 'K21.9' 10% of records, and the rest 'other'.

Turn 3

Please visualize the age distribution of the patient records.

Turn 4

Now, add a 'blood_type' column (e.g., A+, O-, B+).

Turn 5

Looks perfect. Generate the final Python script for me.

Turn 6

Generate a full database export in PostgreSQL SQL format.

For this conversation:

Total input tokens
Total output tokens
Total cost

547,730

25,665

$2.60

Last updated