4.2Calling ChatGPT, Claude, Gemini in a workflow
The essentials in 30 seconds
- AI becomes a workflow step: you send a prompt (instruction + data) and recover the answer for what follows.
- Precise prompt + JSON output: quality depends on the prompt; asking for JSON enables clean chaining.
- Each call is paid for in tokens: filter before calling and limit the size sent to control costs.
Running case — Lina classifies support requests
Lina receives dozens of support messages daily in Oran: billing, technical, other — sorted by hand. She adds an AI step after the trigger: the prompt requests a JSON category from the message text, then a router directs each case to the right treatment. First test on real messages, concise answers required, costs monitored. Lina has just automated “language understanding” without coding.
Sequel to case 4.1 — Lina moves from choosing the tool to her first AI step.
1. AI as a step
Automation changes dimension when you integrate an AI model. In a workflow (Make, n8n, Zapier), you add a call to ChatGPT (OpenAI), Claude (Anthropic) or Gemini (Google) to process language: summarise an email, classify a ticket, extract information, generate an answer, translate. As with Lina's support sorting, AI becomes a step between the trigger and the final action.
2. Prompt, format, cost
Simple principle: you send a prompt (instruction + data), the model returns a text result that you recover for what follows (writing it to a database, sending it, using it in a condition). Quality depends on prompt precision: clear instruction, closed categories, example of the expected format.
You manage the format (ask for JSON to reuse cleanly) and the cost (each call is billed in tokens, input + output). Lina filters upstream, sends only the useful text and demands concise answers: AI delegates “language understanding” to the machine, provided you drive it frugally.
3. Switching models stays simple
The three models cover most common needs; the choice depends on pricing, available connectors and your tests on your real cases. Since the call goes through a standard interface (key + module to swap), switching models is often trivial: Lina prototypes with one, compares with another, and does not over-optimise this choice at the start.
🔎 Concrete example — 🔎 Concrete example — Classifying a ticket
Lina's AI step, with a prompt that imposes the format:
Prompt: “Classify this ticket as:
Billing / Technical / Other.
Answer in JSON: {category}.”
Data: {ticket body}
→ JSON answer → router by category.
Reading: one “understanding” task automated in a single step.
Lesson: ask for JSON to chain cleanly.
Section vocabulary
- LLM (language model)
- Text-trained AI (ChatGPT, Claude, Gemini) able to summarise, classify, extract, generate, translate.
Simple example: Lina uses it to classify support messages instead of sorting them by hand.
What it is not: a search engine or a database.
Reflex: reserve the LLM for language tasks, not storage.
- Prompt
- Instruction sent to the model (instruction + data) that determines the quality and shape of the answer.
Simple example: “Classify this ticket into these 3 categories, answer in JSON”: instruction + data.
What it is not: a vague keyword thrown in with no instruction or format.
Reflex: always re-read your prompt: clear instruction + imposed format?
- Token
- Text-chunking unit used to bill model calls, input + output.
Simple example: Each of Lina's support messages + the answer consume tokens.
What it is not: an automation operation billed by the SaaS.
Reflex: estimate input + output before industrialising.
- Structured output (JSON)
- Formatted answer requested from the model so it can be cleanly reused downstream in the workflow.
Simple example: The {category} returned by the AI feeds Lina's router directly.
What it is not: a free paragraph to reinterpret by hand.
Reflex: demand the format in the prompt, verify before chaining.
- AI step
- LLM call module inserted in a workflow, between the trigger and the final action.
Simple example: At Lina's: message trigger → classification AI step → router.
What it is not: an autonomous agent deciding its actions alone (see 4.3).
Reflex: place AI as a function, not as a decision-maker.
In practice — In practice — Integrating an LLM into a workflow
- In your workflow, add an AI call module after the trigger, with your API key stored safely (see 4.5).
- Write a clear prompt: “Summarise this email in 3 bullets” or “Classify this ticket as: Billing / Technical / Other”, JSON format required.
- Inject only the useful trigger data (the message body, not entire attachments).
- Recover the answer and use it: write it to your database, send it, or use it in a condition (router).
Ready-to-say script — framing data sent to AI (30 s)
«This is Lina: before plugging AI into our customer messages, I minimise what we send it — useful text only, no sensitive attachments — and I have the circuit validated by IT. We test on a sample, monitor token costs, then decide.»
To say before any connection to real data; trace what is sent to the model.
Copy-paste template — AI step sheet (fictitious example)
AI STEP SHEET — fictitious example to adapt
TRIGGER: _______________ (e.g. new support message)
DATA SENT (useful text only): _______________
PROMPT: “_______________ Answer in JSON: {_______________}.”
MODEL: _______________ (key stored safely, see 4.5)
OUTPUT → NEXT: _______________ (write / send / route)
ANTI-WASTE FILTER: only call if _______________
COST MONITORED ON: _______________
Small volumes, tight budget
Filter drastically before calling (keywords, conditions): AI only handles cases that truly deserve it.
Messages with sensitive data
Like Lina: minimise, anonymise where possible, and have the circuit validated by the DSI/RSSI before real data.
Multilingual need (Arabic, French)
Test the same prompt in each language on a sample: quality varies, but the JSON format remains your safeguard.
Team new to AI
Start with a bounded case (3-category classification) rather than free generation: predictable, measurable, cheaper.
✓ Best practices
- Craft the prompt carefully (clear instruction + useful data).
- Ask for JSON for clean reuse.
- Filter before calling, limit size.
✗ Common pitfalls
- Calling AI on every event.
- Sending whole attachments instead of the useful text.
- Over-optimising the model choice.
Key takeaways
- ChatGPT/Claude/Gemini are integrated as a workflow step to process language.
- Use cases: summarise, classify, extract, generate, translate, analyse sentiment.
- Quality depends on the prompt; asking for JSON eases reuse.
- Each call is billed in tokens: mind prompt and volume to control costs.
48h challenge — apply tomorrow
Add 1 AI step to a real workflow (classification or summary), with a prompt imposing JSON and minimised data — then measure the token cost.
- I can explain prompt, token and structured output.
- I can chain an AI answer to a router.
- I have plugged in 1 frugal AI step and measured its cost.
Frequently asked questions
Which model to choose between ChatGPT, Claude and Gemini?
All three cover most common needs. The choice depends on pricing, available connectors and your tests on your real cases. Prototype the same task with two models and compare quality, cost and consistency. Since the call goes through a standard interface, switching is often trivial: do not over-optimise this choice at the start.
How to control AI call costs?
Filter upstream to call only when needed, limit the size sent, choose a suitable model (a small one is often enough for classification), demand concise answers (output is billed too) and monitor consumption. Frugality is designed in when the workflow is built.
How do you integrate AI into a workflow?