MyRelay

← Back to the notebook

Gemini CLI for Quick Scripts: A Solo Setup

A quick script should remove a small annoyance, not become an afternoon of setup and unexpected charges. Gemini CLI can help you turn a clearly described task into a working utility, provided you keep its scope narrow and review what it does. This walkthrough builds a simple workflow for generating, testing, and improving scripts while keeping spending visible.

Choose a small task with a clear finish line

Start with something you can check in minutes: summarizing a local data export, finding duplicate rows, or previewing changes to filenames. Avoid making your first task a script that deletes records, changes permissions, or connects to a production service.

For this walkthrough, imagine a utility that reads a transaction export and totals spending by category. Define the expected input columns, the desired output, and what should happen when a row contains an invalid amount. A precise task reduces both guesswork and the number of paid revisions.

Install the official CLI and connect your account

Install Gemini CLI using its current official instructions, checking the runtime requirements for your operating system first. Launch it in a dedicated workspace containing only your sample data and any notes the task needs. This limits irrelevant context and makes proposed changes easier to inspect.

If you want one personal key and one budget across supported tools, create a MyRelay account. MyRelay is a pay-as-you-go relay that works with Gemini CLI, and its request history shows token usage and cost.

Follow MyRelay’s current Gemini CLI setup instructions to connect the tool. Use the authentication method, endpoint settings, and model identifier specified there rather than assuming that Google account sign-in routes requests through the relay. Store your key using the recommended secret-handling method, and never include it in prompts or sample files.

Verify the connection before requesting a script

Choose Gemini 2.5 Flash as a starting model for a small scripting task, if it is available in your configured CLI session. Begin with one short request asking for a plain-language plan, without file changes or tool execution.

Then check MyRelay’s request history. Confirm that the request appears under your account and inspect its tokens and cost. This establishes that the connection works before you begin a longer session. If the request is missing, troubleshoot the configuration rather than repeatedly sending larger prompts.

Describe the script as a bounded assignment

Ask the CLI to build the transaction-summary utility in a language you already understand. Specify that it should read one input, validate the required columns, total valid amounts by category, and report malformed rows clearly. Request standard-library dependencies where practical.

Include a few invented sample rows and their expected totals. Tell the assistant not to modify the original data, install packages, or contact external services without approval. Ask it to explain its approach before making changes. These boundaries make the result easier to review and reduce unnecessary exploration.

Review permissions and test a disposable example

Read each proposed action before approving it. For this task, unrelated file access, network requests, and package installation deserve a pause. Keep approval prompts enabled while you learn how the CLI behaves.

Inspect the generated script before running it. Check how it handles empty input, missing columns, invalid amounts, and decimal arithmetic. Test it against a disposable sample whose totals you calculated yourself, then confirm that the source data remains unchanged. Successful execution alone does not prove that the totals are correct.

Make targeted fixes and stop when the task works

If a test fails, provide the specific error and the smallest relevant example. Ask for a focused correction rather than a complete rewrite. Avoid pasting an entire export when a few anonymized rows demonstrate the problem.

Check request costs after the first revision and set a personal spending threshold for the session. Once the script passes your checks, save the reviewed version and a short usage note. A useful stopping point is a small tool you understand, can rerun independently, and no longer need to keep discussing with a model.

More to read