AI cost control Python

green-batch-aiRun bulk AI jobs at half price and on cleaner power

green-batch-ai writes OpenAI, Anthropic and Gemini batch files (about half the price of live calls), finds the lowest-carbon time and place to run them from grid forecasts, and plans concurrency under your rate limits.

PyPI pip install green-batch-ai

Free · MIT license · runs on your machine · no signup PyPI ↗GitHub ↗

How green-batch-ai works

Bulk AI work such as writing thousands of product descriptions, tagging reviews or embedding a catalogue rarely needs answers in seconds, yet it usually runs like live traffic: full price, fighting rate limits, at whatever hour someone pressed run.

green-batch-ai fixes the three parts. It turns your prompts into batch files for OpenAI, Anthropic or Gemini, which all charge half price for batch jobs, and splits them under each provider’s limits. For jobs that must use the live API, it works out how many requests to run at once so you stop hitting rate limits. For jobs on your own machines, it reads a real carbon-intensity forecast and finds when, or where, to run them for the cleanest electricity, and it tells you honestly when waiting is not worth it.

Try it

pip install green-batch-ai
green-batch-ai plan --signal uk --hours 4 --watts 2000 --deadline 2026-12-05T12:00Z

Free and open source under the MIT license. Running large AI jobs and want the bill and footprint down? Book a call.

Agent skill included

Let your AI coding agent run green-batch-ai for you

The green-batch-ai skill works with Claude Code, Codex, Cursor, Gemini CLI and other agents that read SKILL.md files. It runs the tool, explains each finding in plain words and helps you fix it.

npx skills add MuhammadAhmadZia/green-batch-ai --skill green-batch-ai

Using the Claude or ChatGPT apps instead? Download the skill ZIP from the GitHub releases page and upload it under Skills.

See all 30 agent skills →

Questions about green-batch-ai

How much can timing save?

It depends on the grid. On a windy night in Great Britain the same job can produce less than half the CO2 of the afternoon. Where power is mostly fossil all day, timing saves little, and the tool says so.

Which countries have forecasts?

Great Britain through the free NESO Carbon Intensity API, and most of the world through Electricity Maps with a token. You can also load your own forecast file.

Does carbon-aware timing work with batch APIs?

Not really: the provider decides when a batch runs within its window. For API jobs the batch discount is the saving; timing is for jobs on your own machines.

What does the batch API save?

OpenAI, Anthropic and Gemini all charge half price for batch jobs, in exchange for results within up to 24 hours.

UN Sustainable Development Goals

How each tool maps to SDG targets →

Want this set up and tuned for your store?

The tools are free. If you would rather have the checks run, the findings fixed and the results measured for you, that is what I do for clients.