Tips for Saving AI Tokens to Avoid Overspending

WI
Wilan
8 min read
Efficiency AI Token

If you often use AI like ChatGPT, Claude, Gemini, or AI models via API, the term token will certainly come up often.

Tokens are essentially pieces of text processed by AI. The longer the conversation, prompt, document, and generated response, the more tokens are used.

If you only use AI occasionally, you might not notice it too much. But if AI is used for applications, automation, chatbots, translators, or generating articles in large quantities, uncontrolled token usage can cause costs to balloon.

Here are some simple ways to save AI tokens without sacrificing too much output quality.

1. Don't Make Prompts Too Long

A fairly common mistake is putting too many instructions into the prompt.

For example:

Please write an article about Bali.
The article must be easy to read.
Use English.
Don't be too formal.
Make it sound human.
Don't use language that's too difficult.
Make sure it's easy to understand for tourists.
Use simple sentences.

Some instructions can actually be combined.

For example:

Write a casual and easy-to-read English travel article about Bali for international tourists.

The requested result remains clear, but the number of tokens sent is much lower.

The simple principle is:

Prompts should be clear, not long.

2. Limit AI Response Length

If you only need a short answer, don't let AI produce overly long text.

You can add instructions like:

Answer in maximum 150 words.

or:

Give only the final answer without explanation.

This is very useful if AI is used via API because AI output is also usually counted as tokens.

The longer the output, the higher the cost.

3. Don't Send the Entire Conversation If Not Needed

In chatbot applications, one cause of high token usage is that the entire chat history is always sent back to the AI.

For example, the conversation has reached 50 messages.

If every request sends all 50 messages, the AI has to re-read all of them each time there's a new question.

But the AI might only need the last 5 to 10 messages.

The solution is to only send:

System instruction
+
last 5 messages
+
latest user message

For more complex applications, older conversations can also be summarized first.

4. Use Summaries for Long Conversations

If the AI still needs context from previous conversations, you don't have to send everything in full.

For example, a previous conversation had 10,000 tokens.

Instead of resending everything, create a summary like:

User is building a villa booking application using Next.js and Laravel.

Current progress:
- Authentication completed
- Booking API completed
- Calendar integration still in development
- User prefers JavaScript instead of TypeScript

That summary might only use a few hundred tokens but still provides sufficient context to the AI.

This method is very effective for chatbots with long conversations.

5. Choose the Model According to the Task

Not all tasks require the most advanced AI model.

For simple tasks like:

  • Translation
  • Classification
  • Creating meta descriptions
  • Cleaning up text
  • Extracting data
  • Determining categories
  • Creating tags
  • Sentiment analysis

a smaller model is usually sufficient.

More powerful models are better suited for tasks like:

  • Complex analysis
  • Coding
  • Planning
  • Reasoning
  • Reading complex documents
  • Making decisions based on large amounts of data

A good strategy is to use multiple models within one application.

For example:

Translation โ†’ small model
Classification โ†’ small model
Article generation โ†’ medium model
Complex reasoning โ†’ large model

This way, AI costs can be much more controlled.

6. Don't Send Unnecessary Data

For example, you want AI to create a product description.

Don't send the entire product data like this:

{
  "id": 8293,
  "created_at": "...",
  "updated_at": "...",
  "internal_code": "...",
  "database_id": "...",
  "name": "Villa Bumi",
  "bedroom": 4,
  "location": "Kerobokan",
  "description": "...",
  "internal_notes": "...",
  "staff_id": "...",
  "supplier_id": "..."
}

If the AI only needs:

{
  "name": "Villa Bumi",
  "bedroom": 4,
  "location": "Kerobokan",
  "description": "..."
}

just send that part.

The cleaner the data sent to AI, the fewer tokens are wasted.

7. Avoid Overly Large JSON

JSON is indeed convenient for communication between applications and AI.

The problem is that JSON format can use quite a lot of tokens because field names are repeated.

For example:

{
  "villa_name": "Villa A",
  "villa_location": "Seminyak",
  "villa_bedroom": 4
}

If the data has thousands of rows, the token usage just from field names can be significant.

For large amounts of data, a simpler format can sometimes be more efficient.

For example:

Villa A | Seminyak | 4BR
Villa B | Umalas | 3BR
Villa C | Canggu | 5BR

Just make sure the format is easy for the AI and your application to understand.

8. Use RAG for Large Documents

If you have hundreds of articles or documents, don't send all of them every time a user asks.

Use the RAG (Retrieval-Augmented Generation) system.

The basic concept:

User asks
โ†“
Search for relevant documents
โ†“
Take a few important parts
โ†“
Send those parts to AI
โ†“
AI generates an answer

For example, your database has 1,000 articles.

The user asks:

How much does airport transfer cost?

The system just takes documents that discuss airport transfer.

The AI doesn't need to read all 1,000 articles.

Besides saving tokens, this method usually makes answers more relevant too.

9. Limit the Amount of Data from the Database

The same applies when AI takes data from a database.

For example, you have 50,000 bookings.

Don't directly send:

SELECT * FROM bookings;

If the question is:

How many bookings in August?

it's better for the database to do the filtering first.

For example:

SELECT *
FROM bookings
WHERE check_in >= '2026-08-01'
AND check_in < '2026-09-01';

Even if the AI only needs the number of bookings, the database can directly do:

SELECT COUNT(*)
FROM bookings
WHERE check_in >= '2026-08-01'
AND check_in < '2026-09-01';

Let the database do the work that is indeed more suitable for the database.

Don't throw everything to the AI.

10. Don't Ask AI to Produce Data That Already Exists

For example, the application already knows:

Check-in: 10 August
Check-out: 15 August

If you just want to know the number of nights, you actually don't need AI.

Calculations like:

15 August - 10 August = 5 nights

are better done directly with code.

AI should be used for tasks that genuinely require language or reasoning abilities.

Simple things like:

  • Calculations
  • Filtering
  • Sorting
  • Date formatting
  • Data conversion
  • Simple validation

are usually cheaper and faster to do directly in the application.

11. Cache Frequently Used AI Results

If the same questions come up often, consider using cache.

For example, users often ask:

What time is check-in?

If the information is always the same, there's no need to call the AI every time.

The previous result can be stored.

The concept:

User request
โ†“
Check cache
โ†“
Result available?
โ”œโ”€โ”€ Yes โ†’ use old result
โ””โ”€โ”€ No โ†’ request AI โ†’ save to cache

Caching is very useful for applications with high traffic.

12. Don't Provide Too Many Examples

Examples in prompts do help AI understand the desired format.

But too many examples also increase token usage.

For example, you have 20 article examples.

Not all of them necessarily need to be sent.

Usually it's enough to provide:

1 to 3 best examples

Choose examples that best represent the output style you want.

13. Separate Mandatory and Optional Prompts

If you have a large system prompt, try to review each instruction again.

Ask:

Does the AI really need this instruction for every request?

If the answer is no, that instruction can perhaps be removed or only sent when needed.

A system prompt that was initially 3,000 tokens can sometimes be trimmed to 800 to 1,500 tokens without major changes to the output.

If the application processes thousands of requests, such savings can be quite significant.

14. Monitor Token Usage

Don't just look at the total AI bill at the end of the month.

It's better to record token usage for each request.

For example:

Feature: Article Generator
Input Tokens: 1,240
Output Tokens: 1,850
Total Tokens: 3,090

Then compare with other features:

Translator
Average: 850 tokens

Article Generator
Average: 3,500 tokens

Customer Support
Average: 6,200 tokens

From this, you can see which feature uses the most tokens.

15. Calculate Cost per Request

For commercial applications, one important number is cost per request.

For example:

1 request = Rp20

If there are:

100 requests per day

that means around:

Rp2,000 per day

But if there are:

100,000 requests per day

the cost becomes:

Rp2,000,000 per day

That's why small optimizations can have a huge impact when an application starts having many users.

The Most Effective Strategy Combination

If you want to use tokens more efficiently, you can use a flow like this:

User Request
โ†“
Can it be done without AI?
โ†“
Yes โ†’ process with application
โ†“
No
โ†“
Take only relevant data
โ†“
Use the cheapest model capable of doing the task
โ†“
Limit output length
โ†“
Save result to cache if possible

With a system like this, AI is used only when truly needed.

Conclusion

Saving tokens doesn't mean making AI dumber or making prompts as short as possible.

What needs to be done is removing information that doesn't add value to the final result.

Some of the most effective optimizations are:

  • Making prompts more concise
  • Limiting output length
  • Not sending the entire chat history
  • Summarizing old conversations
  • Choosing the model according to the task
  • Sending only necessary data
  • Using RAG for large documents
  • Filtering in the database
  • Using code for simple tasks
  • Using cache
  • Monitoring cost per request

If AI is used on a large scale, saving just a few hundred tokens per request can lead to significant savings.

The bottom line is, don't use AI to process data that AI doesn't actually need to read.

W

Written by

Wilan

A regular contributor to Bali Island Tekno who actively shares knowledge about technology, programming, and the world of software engineering.

Back to Home Updated on: August 18, 2026