> For the complete documentation index, see [llms.txt](https://docs.tensorx.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tensorx.ai/ai-coding-assistants/aider.md).

# Aider

[Aider](https://aider.chat/) is an AI pair programming tool that works in your terminal. It integrates with TensorX through its OpenAI-compatible API support.

## Prerequisites

* Aider installed (`pip install aider-chat`)
* TensorX API key from [app.tensorx.ai](https://app.tensorx.ai)

## Configuration

### Environment Variables

Set the following environment variables to connect Aider to TensorX:

```bash
# Mac/Linux
export OPENAI_API_BASE=https://api.tensorx.ai/v1
export OPENAI_API_KEY=your-tensorx-api-key

# Windows (PowerShell)
$env:OPENAI_API_BASE = "https://api.tensorx.ai/v1"
$env:OPENAI_API_KEY = "your-tensorx-api-key"

# Windows (Command Prompt)
setx OPENAI_API_BASE https://api.tensorx.ai/v1
setx OPENAI_API_KEY your-tensorx-api-key
```

### Using with Aider

Navigate to your project directory and start Aider with a TensorX model:

```bash
cd /path/to/your/project

# Use with Claude models via TensorX
aider --model openai/claude-sonnet-4-20250514

# Use with GPT models via TensorX
aider --model openai/gpt-4o
```

The `openai/` prefix tells Aider to use the OpenAI-compatible endpoint.

## Persistent Configuration

You can also set these in a `.env` file in your project directory:

```env
OPENAI_API_BASE=https://api.tensorx.ai/v1
OPENAI_API_KEY=your-tensorx-api-key
```

Or use Aider's YAML configuration file (`.aider.conf.yml`):

```yaml
openai-api-base: https://api.tensorx.ai/v1
openai-api-key: your-tensorx-api-key
model: openai/claude-sonnet-4-20250514
```

## Available Models

Check [TensorX Models](/api-reference/models.md) for the full list of available models. Popular options include:

| Model                        | Best For                           |
| ---------------------------- | ---------------------------------- |
| `claude-sonnet-4-20250514`   | Complex reasoning, code generation |
| `claude-3-5-sonnet-20241022` | General coding tasks               |
| `gpt-4o`                     | Fast responses, multi-modal        |
| `gpt-4-turbo`                | Large context, document analysis   |

## Troubleshooting

### Empty responses

If you receive empty responses, verify:

1. Your API key is correctly set
2. The base URL includes `/v1` at the end
3. The model name uses the `openai/` prefix

### Model warnings

Aider may show warnings for unfamiliar models. These can be safely ignored as TensorX handles model compatibility.

## Resources

* [Aider Documentation](https://aider.chat/docs/)
* [TensorX API Reference](/api-reference/overview.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tensorx.ai/ai-coding-assistants/aider.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
