Skip to main content
Aider is an AI pair programming tool that runs in your terminal. It allows you to edit code in your local Git repository using natural language commands. By connecting Aider to Cerebras Inference, you can leverage ultra-fast inference speeds for an enhanced coding experience.

Prerequisites

Before you begin, ensure you have:
  • Cerebras API Key - Get a free API key here
  • Python 3.10 to 3.12 - Current Aider releases do not support Python 3.13
  • Git - Aider works with Git repositories to track changes
  • A code editor - While Aider runs in the terminal, you’ll want an editor to view your files

Installation and Setup

1

Install Aider

Install Aider using pip. This will download and install the latest version of Aider and its dependencies.
Alternatively, you can use pipx for an isolated installation:
Using pipx is recommended for isolated environments, as it installs Aider in its own virtual environment.
2

Set up your Cerebras API key

Aider needs your Cerebras API key to authenticate requests. Set it as an environment variable so Aider can access it.
For a permanent setup, add this line to your shell configuration file (~/.bashrc, ~/.zshrc, etc.).
3

Initialize your project directory

Aider works with Git repositories to track changes. Navigate to your project and ensure it’s a Git repository.
If your project is not already a Git repository, initialize one:
Aider uses Git to track all changes it makes, allowing you to easily review and revert modifications.
4

Create an Aider configuration file

Create an .aider.conf.yml file in your project root for easier usage. This eliminates the need to specify connection details every time you launch Aider.You can create this file via a terminal command:
With this configuration, you can simply run aider without additional flags.

Using Aider with Cerebras

1

Start Aider with a Cerebras model

Launch Aider and specify a Cerebras model using the OpenAI-compatible API. If you created a configuration file, simply run aider. Otherwise, use the full command:
This command tells Aider to use the gpt-oss-120b model from Cerebras and connect to Cerebras’s API endpoint.
The cerebras/ prefix tells Aider to use LiteLLM routing to Cerebras, which automatically configures the correct API endpoint. The --openai-api-key flag is used because Aider expects this parameter name for OpenAI-compatible providers.
2

Create a new file from scratch

Since we are starting with an empty project, let’s ask Aider to create a file. Aider can generate code and create files based on your instructions.Paste this prompt into Aider:
Aider will create fibonacci.py with the implementation. You don’t need to manually create the file first.
3

Refine the code

Now, let’s ask Aider to improve the implementation. The model will analyze the existing code and apply your requested changes.
Aider will:
  1. Analyze the recursive implementation
  2. Rewrite it to use iteration
  3. Add the main execution block
  4. Commit the changes to Git
4

Run the code

You can run shell commands directly within Aider to verify the changes.
Aider will run the command and show the output:
You can choose to add this output to the chat so Aider can see the result and fix any errors if they occur.
5

Review and undo

You can inspect the changes Aider made or undo them if you’re not satisfied.To see the last change:
To undo the last change:
Aider will revert the changes:
Cerebras offers several models that work well with Aider. Choose based on your needs for speed versus capability:
  • gpt-oss-120b: Largest model for the most demanding tasks
  • zai-glm-4.7: 355B preview reasoning model scheduled for deprecation on August 17, 2026
For the best experience with Aider, we recommend using cerebras/gpt-oss-120b as it provides excellent code understanding and generation capabilities while maintaining fast inference speeds.

Advanced Usage

Using Different Edit Formats

Aider supports multiple edit formats. For Cerebras models, the default “whole” format works well, but you can experiment with others: To use whole file editing (recommended for Cerebras):
To use diff-based editing for smaller changes:

Architect Mode

For high-level design discussions before coding, use architect mode. This is useful for planning changes, discussing architecture, or exploring different approaches:
In architect mode, Aider won’t make direct code changes but will help you think through design decisions.

Streaming Responses

Enable streaming to see responses as they’re generated, providing immediate feedback:

Working with Multiple Models

You can use different models for different tasks. For example, use a larger model for complex edits and a smaller one for simple changes:

Example Session

Here’s a complete example of using Aider with Cerebras to add a new feature to a Python project. First, start Aider from your terminal:
Then, inside the Aider chat, run the following commands and prompts:

Troubleshooting

Ensure your API key is correctly set and accessible:
If empty, set it again:
Verify the API base URL is correct: https://api.cerebras.ai/v1If you’re still having issues, try running Aider with verbose logging:
Some models may struggle with code editing, or the edit format may not be optimal. Try:
  1. Using a more capable model like gpt-oss-120b
  2. Switching edit formats: --edit-format whole
  3. Being more specific in your requests with examples
  4. Breaking complex changes into smaller, incremental steps
  5. Adding more context files with /add
You can also check Aider’s LLM leaderboards to see how different models perform.
Aider requires a Git repository to function properly. Ensure:
  1. You’re in a Git repository: git status
  2. You have an initial commit: git log
  3. Your Git configuration is set up: git config user.name and git config user.email
If needed, initialize Git:
Then restart Aider.
If you encounter rate limits or quota errors:
  1. Check your Cerebras dashboard for current usage
  2. Consider upgrading your plan for higher limits
  3. Reduce unnecessary context and output tokens
  4. Add delays between requests if using Aider programmatically
  5. Break large changes into smaller sessions
Cerebras offers generous rate limits, but very intensive usage may require a paid plan.
If Aider feels slow:
  1. Ensure you’re using a Cerebras model (they’re optimized for speed)
  2. Reduce the number of files in context with /drop filename
  3. Use streaming mode: --stream
  4. Check your internet connection
  5. Reduce the amount of repository context sent with each request
Cerebras models are typically very fast, so slowness often indicates network issues or too much context.

FAQ

For the best experience, use gpt-oss-120b. It provides excellent code understanding and generation capabilities while maintaining fast inference speeds.For the best current experience, use gpt-oss-120b and keep the repository context focused on the files relevant to your task.Check Aider’s LLM leaderboards to see how different models perform on code editing tasks.
Yes! Use the /add command to include multiple files in the conversation:
Aider will maintain context across all added files. You can also add entire directories:
Use /drop filename to remove files from context if needed.
Absolutely! Aider works with any programming language including JavaScript, TypeScript, Java, C++, Go, Rust, and more. It uses Git for version control and can edit any text-based files.The model’s ability to work with different languages depends on its training, but Cerebras models like gpt-oss-120b have strong multi-language capabilities.
Since Aider commits changes to Git, you can use standard Git commands:To view commit history:
To undo the last commit but keep the changes in your files:
To undo the last commit and discard the changes:
To revert a specific commit:
You can also use /undo within an Aider session to undo the last change before it’s committed.
Yes! Aider can be used programmatically in CI/CD pipelines for automated code improvements, refactoring, or documentation generation.Use the programmatic API with the yes=True flag to auto-approve changes:
Always test on a separate branch and review changes before merging.
Cerebras offers a free tier with generous limits. Costs depend on:
  • The model you choose (larger models cost more per token)
  • The number of tokens processed (input + output)
  • Your usage volume
Check the Cerebras pricing page for current rates. Cerebras is typically very cost-effective due to fast inference speeds and competitive pricing.

Next Steps