Reading time: 3 minutes

Looking to experiment with cutting-edge AI models for coding without breaking the bank? While premium tools like Cursor and Windsurf offer polished experiences, they come with subscription costs that can add up. If you're curious about modern language models but want a budget-friendly way to explore their capabilities, combining Aider with Cody offers an interesting alternative worth considering.

This approach isn't perfect – it comes with limitations and requires more setup than plug-and-play solutions. But for developers who enjoy tinkering and want to experience models like Claude Sonnet 4 without monthly fees, it's a compelling option to explore.

What You're Working With

Aider is an open-source command-line tool designed for AI-assisted coding. Unlike IDE-integrated solutions, it works directly with git repositories, making commits based on natural language instructions. It supports various editors and focuses on making actual code changes rather than just providing suggestions.

Cody is Sourcegraph's AI assistant that powers chat, code completion, and automated code edits. Its free plan includes 200 messages per month with premium models like Claude Sonnet 4. These limits mean this setup works best for occasional experimentation, learning, or small projects rather than heavy daily development. If you're planning to use AI assistance extensively, you'll likely hit these caps quickly. However, for exploring what modern language models can do or handling specific coding challenges, these quotas can be quite useful.

Setting Up Aider with Cody's Cloud Endpoint

The integration process involves connecting Aider directly to Sourcegraph's cloud API rather than running a local Cody CLI instance.

Step 1: Install Aider

Follow the official document, e.g.

python -m pip install aider-install
aider-install

Step 2: Generate Your Access Token Visit Sourcegraph's token settings page at https://sourcegraph.com/users/<your-username>/settings/tokens and create a new access token. This token authenticates your requests to Sourcegraph's LLM API.

Step 3: Configure Your Project In your project directory, create two configuration files that tell Aider how to communicate with Sourcegraph's endpoint:

# .aider.conf.yml
openai-api-base: https://sourcegraph.com/.api/llm
openai-api-key: sgp_xxxxx # put your actual access token here
model: openai/anthropic::2024-10-22::claude-sonnet-4-latest

# .aider.model.settings.yml
- name: openai/anthropic::2024-10-22::claude-sonnet-4-latest
  use_system_prompt: false
  extra_params:
      extra_headers:
        X-Requested-With: aider 0.0.0
      max_tokens: 64000

The first file handles basic authentication and model selection, while the second configures specific parameters for optimal performance with Claude Sonnet 4, including the maximum token limit and required headers.

Step 4: Launch and Code With your configuration in place, simply run aider from your project directory. Aider will automatically use your settings to connect to Sourcegraph's API and give you access to Claude Sonnet 4 within your free usage limits.

Is This Right for You?

This setup works best for developers curious about modern AI models without subscription commitments – students, hobbyists, or those working on side projects. The quota limitations make it unsuitable for heavy daily use, but as an accessible entry point into AI-assisted development, it offers genuine learning value.

Consider it a stepping stone to understand how AI can enhance your coding. Once you've explored the capabilities within these constraints, you can make informed decisions about investing in more comprehensive solutions.