Skip to content

Managing Costs

Every time an agent runs, Pencel sends tokens to your chosen AI provider. Understanding how costs work — and how to control them — helps you get the most value without surprises on your API bill.

How token costs work

AI models charge based on tokens — small chunks of text (roughly 4 characters or 3/4 of a word). There are two types:

  • Input tokens: Everything you send to the model — the system prompt, guidelines, memory, context files, conversation history, and tool definitions. You pay for these every time the model is called.
  • Output tokens: Everything the model generates in response — answers, plans, tool calls, and artifacts. These typically cost 3-5x more per token than input tokens.

A single agent run may make multiple API calls — one for each step in a workflow or each turn in a conversation. Each call incurs its own token costs.

INFO

Token counts grow with context. A long conversation history, many active guidelines, and large context files all increase the input tokens sent with every API call.

The Cost & Usage view

Pencel tracks every token spent. Open the Cost & Usage section in Settings to see:

  • Per-run costs: How much each workflow run or chat session cost, broken down by model.
  • Per-date costs: Daily spending totals so you can spot trends.
  • Token breakdown: Input vs output tokens for each call.

Use this view to identify which agents, workflows, or conversations are driving your spending.

Set spending limits per agent

Every agent has a Max Cost Per Run setting. This is your first line of defense against runaway costs — if a run exceeds the limit, Pencel stops the agent automatically.

Task typeSuggested limit
Simple extraction or formatting$0.25
Weekly summary report$1.00
Multi-step analysis workflow$3.00
Complex research with tools$5.00

WARNING

Without a cost cap, an agent stuck in a loop can spend indefinitely. Always set a limit — even a generous one like $5.00 — on every agent. You can adjust it after seeing real costs in the Cost & Usage section.

Typical costs by task type

These are rough ranges to help you set expectations before your first runs. Actual costs depend on model, context size, and number of steps.

TaskTypical cost per runRecommended model
Simple extraction / formatting$0.01 – $0.05Gemini Flash, GPT-4o mini
Weekly summary report$0.05 – $0.25Gemini Flash or Claude
Multi-step analysis (3-5 steps)$0.20 – $1.00Claude, GPT-4o
Complex research with tool use$0.50 – $2.00Claude
Batch processing (10+ items)$1.00 – $5.00Flash/mini per item

INFO

Check the run costs on the Jobs page after your first 3 runs of any new workflow. Real numbers beat estimates.

Model cost comparison

Different models have very different price points. Here is a rough comparison to help you choose.

ModelInput (per 1M tokens)Output (per 1M tokens)Tier
Anthropic Claude~$3 – $15~$15 – $75Premium
OpenAI GPT-4o~$2.50~$10Mid-range
Google Gemini 2.5 Pro~$1.25 – $2.50~$10 – $15Mid-range
Google Gemini 2.5 Flash~$0.30~$2.50Budget
OpenAI GPT-4o mini~$0.15~$0.60Budget

TIP

These prices are approximate and change frequently. Check your provider's pricing page for current rates. The relative ordering is stable — Claude is premium, Flash and mini models are budget. See Supported Models for the full list.

Strategies for reducing costs

1. Use cheaper models for routine tasks

Not every task needs the most capable model. Reserve Claude and GPT-4o for complex analysis, nuanced writing, and critical decisions. Use Gemini Flash or GPT-4o mini for:

  • Simple data extraction and formatting
  • Categorization and tagging
  • Summarizing short documents
  • Template-based output

The tradeoff: budget models handle structured, template-following tasks well but lose nuance in open-ended writing, multi-step reasoning, and ambiguous instructions. If the output requires judgment, pay for a premium model.

2. Write shorter instructions

Every word in your workflow instructions, agent role, and guidelines costs input tokens — on every API call. Tighten your language.

Wordy (42 tokens)Concise (18 tokens)
"I would like you to carefully and thoroughly analyze the provided sales data and then create a comprehensive and detailed summary report.""Analyze the sales data. Create a summary report with key findings."

Over hundreds of runs, this adds up.

3. Limit context files

Context files are included in every API call for agents that use them. Each file adds input tokens.

  • Only attach files the agent actually needs for the current task.
  • Remove outdated context files regularly.
  • Prefer smaller, focused files over large reference documents.

4. Use "when relevant" guidelines

Always-active guidelines are included in every API call. If a guideline only matters sometimes, set its activation mode to when relevant. Pencel will only include it when the current task matches.

5. Keep conversations focused

Long chat conversations accumulate history. Every previous message is sent as context with each new message. For cost-sensitive work:

  • Start new chat sessions for new topics instead of continuing old ones.
  • Use workflows instead of chat for repeatable tasks — workflows do not carry conversation history across runs.

6. Limit memory retrieval

Pencel retrieves relevant memories for each agent interaction. If you have a large memory store, this adds tokens. Review your memory items periodically and delete entries that are no longer useful.

7. Let the conversation compressor help

Pencel automatically compresses older messages when a conversation reaches roughly 85% of the model's context window. It keeps the 10 most recent messages verbatim and summarizes everything before them. This happens automatically — no configuration needed. That said, starting a fresh chat session for a new topic is still more cost-effective than relying on compression in a very long conversation.

Estimating costs before a run

A rough formula for estimating the cost of a single API call:

Cost = (input tokens x input rate) + (output tokens x output rate)

Input tokens come from: agent role + writing style (~100-300), always-active guidelines (~50-200), relevant memories (~100-500), context files (varies), conversation history (grows each turn), and tool definitions (~50-100 per tool).

Output tokens depend on the task — a short answer might be 100 tokens, a full report could be 2,000+.

WARNING

A workflow with 5 steps makes at least 5 API calls. If each call costs $0.02, the full run costs $0.10. At 10 runs per day, that is $1/day or $30/month — just for one workflow. Monitor the Cost & Usage section regularly to catch unexpected spending.

Cost-saving checklist

  • [ ] Does every agent have a Max Cost Per Run set?
  • [ ] Are routine tasks using a budget model (Flash, mini)?
  • [ ] Are workflow instructions as concise as possible?
  • [ ] Are only necessary context files attached?
  • [ ] Are situation-specific guidelines set to "when relevant"?
  • [ ] Are old, unused memory items cleaned up?
  • [ ] Are you starting new chat sessions instead of extending very long ones?
  • [ ] Have you checked the run costs on the Jobs page after the first 3 runs of a new workflow?