AI Workflows

How to Set Up AI Agents in Your Markdown Editor

6 min read
How to Set Up AI Agents in Your Markdown Editor

How to Set Up AI Agents in Your Markdown Editor

Setting up AI agents in Ritemark takes 5-10 minutes. You install a command-line AI tool, configure your API key, and start using it from the built-in terminal. This guide covers the three most popular AI agents: Claude Code, Gemini CLI, and the llm library for OpenAI.


What Do You Need Before Installing?

You need Node.js 18+ for Claude Code and Gemini CLI, and Python 3.9+ for the llm library. Check if they are installed by opening Ritemark's terminal:

Node.js (version 18 or higher) is required for Claude Code and Gemini CLI:

node --version

If you see a version number, you are ready. If not, install via Homebrew:

brew install node

Python 3 (version 3.9 or higher) is required for the llm library:

python3 --version

If not installed, get it from python.org or via Homebrew:

brew install python

How Do You Set Up Claude Code?

Claude Code is the most capable AI agent for writing tasks. It reads your files, makes edits in place, and handles complex multi-step operations like restructuring documents, translating to other languages, or adding sections.

Installation

npm install -g @anthropic-ai/claude-code

Authentication

Run Claude Code once to set up your account:

claude

Follow the prompts to authenticate with your Anthropic account. You need an API key with billing enabled.

First Use

Open a folder with markdown files in Ritemark, then in the terminal:

claude

Claude Code starts an interactive session. Try these prompts:

  • "Read article.md and suggest improvements"
  • "Translate this file to Estonian, save as article-et.md"
  • "Fix all grammar issues in the /docs folder"

Cost

Claude Code uses Anthropic's API with usage-based pricing. Editing a single article typically costs 1-5 cents. Heavy daily usage (multiple articles, translations, batch edits) might cost $1-5 per day.

For detailed setup instructions, see the Claude Code setup guide.


How Do You Set Up Gemini CLI?

Gemini CLI gives you access to Google's Gemini models from the command line. It works well for content generation, analysis, and questions about your documents.

Installation

npm install -g @google/gemini-cli

Authentication

gemini auth

Sign in with your Google account. Gemini CLI uses your Google AI API key.

First Use

In Ritemark's terminal:

gemini

Gemini starts an interactive session where you can ask it to read and analyze your files.

Cost

Gemini offers a free tier with usage limits. Paid API access scales with usage.


How Do You Set Up the llm Library for OpenAI?

The llm library by Simon Willison is a versatile command-line tool that connects to OpenAI, Anthropic, Google, and many other AI providers through a unified interface.

Installation

pip install llm

Authentication

For OpenAI:

llm keys set openai

Paste your OpenAI API key when prompted.

First Use

Quick text generation:

cat article.md | llm "Summarize this article in 3 sentences"

Edit a file and save the result:

cat draft.md | llm "Improve the writing quality, fix grammar" > draft-edited.md

Cost

Depends on the AI provider you configure. OpenAI usage is typically a few cents per request.


Which AI Agent Should You Choose?

For most writing workflows, Claude Code is the recommended choice. Its ability to read and write files directly makes it the most natural fit for Ritemark's terminal-based workflow.

Criteria Claude Code Gemini CLI llm Library
File editing Direct (reads and writes files) Limited Pipe-based (input/output)
Multi-file operations Excellent Basic Manual scripting needed
Writing quality Excellent Good Depends on model
Setup complexity Easy Easy Easy
Cost Usage-based (Anthropic API) Free tier available Depends on provider
Best for Complex editing, translation, restructuring Analysis, generation Quick one-off tasks

Can You Use Multiple AI Agents Together?

Yes. You can install and use all three agents on the same machine. Switch between them based on the task:

  • Use Claude Code for substantial document editing and translation
  • Use Gemini CLI for research queries and analysis
  • Use llm for quick one-line text processing

All three share the same terminal in Ritemark. Just type the command for whichever agent fits your current task.


Frequently Asked Questions

Can I use AI agents without an API key?

Most AI agents require an API key linked to a billing account. The llm library supports some free/local models via plugins, and Gemini CLI offers a free tier. Claude Code requires a paid Anthropic API account.

Do AI agents work offline?

Cloud-based agents (Claude Code, Gemini CLI, OpenAI) require an internet connection. For offline use, you can install local models through the llm library using plugins like llm-ollama that run models on your Mac.

Which agent is best for translation?

Claude Code handles translation best because it preserves markdown formatting, creates new files, and maintains context across long documents. It understands that code blocks, links, and image paths should not be translated.

How do I update AI agents?

Update npm-based agents with npm update -g @anthropic-ai/claude-code and pip-based agents with pip install --upgrade llm. Check for updates periodically to get the latest model access and features.

Can AI agents access files outside my project folder?

Claude Code operates within the directory where you run it (your Ritemark project folder). It can read and write files within that directory tree. It does not access files in unrelated directories unless you explicitly navigate there.

Can I switch between AI agents in the same session?

Yes. Each agent runs as a separate terminal command. You can exit one agent and start another in the same terminal session. You can also open multiple terminal tabs in Ritemark to run agents in parallel.

What happens if my API key is wrong?

Each agent shows an authentication error with a clear message. Claude Code says "Invalid API key", the llm library shows an API error from the provider. Re-run the key setup command to fix it.

How much does Gemini CLI cost?

Gemini CLI offers a free tier with usage limits suitable for light use. Paid access scales with usage through your Google AI API billing. Check pricing at the Google AI developer portal.

Can I use local AI models without an internet connection?

Yes. Install Ollama (brew install ollama) and pull a model like ollama pull llama3. Then use the llm library with the llm-ollama plugin to run models entirely on your Mac with no internet required.

How to Set Up AI Agents in Your Markdown Editor