OverpayingForAIPricing desk

Lesson 5 of 8 · 10 min read · Beginner → Intermediate

Prompting basics for Gemini

How to write prompts that work on Gemini specifically, with three before-and-after examples and the habits that save both retries and tokens.

In this lesson you will

  • Structure a prompt with role, task, context, format and constraints.
  • Use Gemini's strengths — long context and files — instead of fighting them.
  • Rewrite a weak prompt into one that gets a usable answer first time.

A bad prompt costs you twice: once for the answer you cannot use, and again for the retry. On a subscription that burns limits; on the API it burns money. Good prompting is the cheapest cost-control there is, and it is mostly about being specific.

Anatomy of a prompt that works first timeFive parts. Most bad answers are missing two of them.RoleWho the model should be
“You are a pricing analyst…”
TaskThe one thing you want
“Rank these 4 plans by cost per 1K tokens.”
ContextFacts it cannot guess
paste the plan table, your usage
FormatShape of the answer
“a table, then a 2-line verdict”
ConstraintsWhat to avoid
“no marketing language; cite the source”
Cost angleA precise prompt costs a few hundred tokens more and saves the two or three retries that cost thousands.Asking for a short format (“3 bullets”) cuts output tokens — the expensive kind — by half or more.
Figure 1.The parts of a working prompt. You do not need all five every time, but a missing task or format is the usual reason an answer comes back vague.

What is different about Gemini

  • Give it the whole file. Gemini's long context means you should attach the full document rather than a summary you wrote. It will find what it needs. Summarising first throws away the thing the model is good at.
  • Point at the source. Because it reads files and screenshots natively, "look at page 4 of the attached PDF" or "the highlighted cell in this screenshot" works well.
  • Ask for a format. Gemini follows explicit format instructions closely: "a table with three columns", "five bullets, no intro", "valid JSON only". Without them it tends towards long prose.
  • Use Gems for repeat jobs. Anything you would type twice belongs in a Gem (app) or a system instruction (API).

Worked example 1: summarising a report

Before: "Summarise this." (with a 40-page PDF attached). You get a generic ten-paragraph overview that reads like the executive summary you already had.

After: "You are a financial analyst. From the attached annual report, list the five biggest risks the company names, one sentence each, with the page number. Then give one sentence on whether revenue grew or shrank. Do not add an introduction." You get a short, checkable list with sources. Fewer output tokens, more use.

Worked example 2: writing an email

Before: "Write an email to a client about the delay." Gemini invents a reason, a tone and a timeline, and you rewrite most of it.

After: "Draft a 120-word email to a client. Context: the delivery is now Thursday instead of Monday because a supplier missed a shipment. Tone: apologetic but confident, no excuses. End with a specific offer: a 10% discount on the next order. Sign off as Priya." One pass, done.

Worked example 3: getting code

Before: "Write a script to clean my data." You get a plausible script for data you do not have.

After: "Attached is a CSV sample (first 20 rows). Write a Python script using pandas that: removes rows where email is blank, lowercases email, converts signup_date to ISO format, and writes to clean.csv. Return only the code, no explanation." Now Gemini can see the real column names and the constraint "only the code" saves output tokens.

Knowledge check

Which instruction most directly reduces the cost of a Gemini API call?

Lesson FAQ

Does Gemini support system prompts?

Yes. In the app, use Gems. In the API, pass a system instruction with the request. Both do the same job: fixed context that applies to every message.

Should I ask Gemini to think step by step?

For hard reasoning it can help, but it increases output length and therefore cost. Try the plain prompt on Flash first; add reasoning instructions only when the answer is wrong.

Why does Gemini ignore my formatting request?

Usually the request is buried mid-prompt. Put format instructions at the end, be literal ("exactly five bullets"), and if you need machine-readable output on the API, use the structured output feature rather than hoping.

Finished reading?

Mark it done to track your progress through the course.

Compare, calculate, decide — for Gemini

If our calculators helped you cut down on hidden AI wallet leaks, consider buying us a coffee. A tiny fraction of your savings keeps our pricing indexes updated daily.

Not sure which AI is cheapest for your use case? Find out in 30 seconds — no signup required.

AI cost intelligence

Stop overpaying for AI tools

Join the OverpayingForAI list for pricing updates, cheaper alternatives, and practical buying guidance.

Now tracking 50+ AI tools, models, platforms, subscriptions, coding tools, and automation products.

We use your email only for OverpayingForAI updates. Unsubscribe anytime.