n4nAI

Topic

Building CLI Tools for LLM APIs

12 posts on building cli tools for llm apis — part of api integration on the n4n AI blog.

API integrationHow-to

Testing an LLM CLI tool: mocking GPT-5 responses in Python

Learn testing llm cli mock gpt-5 python by building a mocked OpenAI-compatible server and pytest harness for a CLI tool end to end.

3 min read
API integrationHow-to

Streaming GPT-5 responses to the terminal in Python

Learn how to stream GPT-5 responses to the terminal in Python with Server-Sent Events, building a minimal CLI that prints tokens as they arrive.

4 min read
API integrationHow-to

Storing API keys safely in a Python LLM CLI tool

A hands-on tutorial to store API keys Python CLI apps securely using environment variables, OS keyring, and encrypted files with verification for LLM tooling.

4 min read
API integrationHow-to

Packaging your Python LLM CLI tool with pipx

Learn how to package python llm cli pipx tools for clean isolated installs, from project layout to publishing on PyPI and verifying the install.

3 min read
API integrationHow-to

From bash script to Python CLI: wrapping GPT-5 calls with Click

Build a robust Python CLI for GPT-5 using Click: project setup, API calls, streaming, retries, and packaging with runnable code and verification steps.

3 min read
API integrationTutorial

Building a Go CLI with Cobra, Viper, and the OpenAI API

Build a Go CLI with Cobra and Viper that calls the OpenAI API. Step-by-step tutorial with runnable code for a practical llm command-line tool.

2 min read
API integrationTutorial

Building a batch summarization CLI with the Claude API in Go

Step-by-step guide to build a batch summarization cli claude api go tool that processes files concurrently with retries and shows expected output.

2 min read
API integrationHow-to

Adding progress bars and spinners to a Go LLM CLI

Step-by-step guide to adding progress bars and spinners to a Go CLI for LLM API calls, covering streaming, spinners, and clean interrupts.

3 min read
API integrationTutorial

Building an LLM CLI tool in Go with Cobra and Claude Opus 4.8

Step-by-step guide to building a Go CLI with Cobra that queries Claude Opus 4.8 via the Anthropic API, including runnable code and expected output.

3 min read
API integrationGuide

Building a multi-model CLI in Python: GPT-5, Claude Opus 4.8, Gemini 3

A practical guide to building a multi-model CLI in Python that routes between GPT-5, Claude Opus 4.8, and Gemini 3 with clean abstractions.

3 min read
API integrationTutorial

Build a GPT-5 command-line client in Python with Click

Step-by-step tutorial to build gpt-5 cli python tool with Click and the OpenAI SDK, including streaming, config, and error handling for engineers.

3 min read
API integrationHow-to

A Go CLI for comparing Gemini 3 and Llama 4 outputs side by side

Build a Go CLI to send one prompt to Gemini 3 and Llama 4 and print responses side by side via an OpenAI-compatible gateway, with full runnable code.

2 min read