# Set up Aider with GLBNXT

### Introduction

Aider is a command-line AI pair programmer that allows you to edit code in your local git repository. Unlike standard chat interfaces, Aider "talks" directly to your files, applying edits, performing refactors, and committing changes automatically. By connecting it to GLBNXT, you get the power of high-performance models directly within your terminal workflow.

### Prerequisites

* **GLBNXT API Key**: You must have an active developer key. If you haven't created one yet, follow our [Developer Keys Guide](https://docs.glbnxt.com/configure-glbnxt/ai-platform/developer-keys).
* **Aider Installed**: Download and install Aider following the [Official Aider Installation Guide](https://aider.chat/docs/install.html).

### Configuration

After Aider is successfully installed on your device, open the project file you want to have Aider co-code in. Then the configuration consists of three steps:

#### 1. Add .env file

Create a file named `.env` and add the following three lines:

```
AIDER_OPENAI_API_BASE=https://ai.glbnxt.com/v1
AIDER_OPENAI_API_KEY=sk-***
AIDER_MODEL=openai/MODEL_ID
```

Use this template, replacing `MODEL_ID` with the exact **Model ID** found in the [GLBNXT Model Hub](https://docs.glbnxt.com/configure-glbnxt/ai-platform/model-hub).

#### 2 .Add .json file

Create a file named `.aider.model.metadata.json` and add the following to it:

```json
{
  "openai/MODEL_ID": {
    "max_context_tokens": VALUE
  }
}
```

Use this template, replacing `MODEL_ID` with the exact **Model ID** found in the [GLBNXT Model Hub](https://docs.glbnxt.com/configure-glbnxt/ai-platform/model-hub) and `VALUE` by your chosen amount of tokens.

* **Tip:** The Context Window (`"max_context_tokens"`) can be found in the [GLBNXT Model Hub](https://docs.glbnxt.com/configure-glbnxt/ai-platform/model-hub) under **Technical Specifications** when clicking on your preferred model.

#### 3. Run Aider

Execute the following command in your terminal to start the session:

```bash
aider
```

Visit their [Usage Page](https://aider.chat/docs/usage.html) to get the most out of Aider.

### Advanced settings

To optimize your experience with Aider, we encourage you to visit their [Advance Model Settings Page](https://aider.chat/docs/config/adv-model-settings.html). Here you can find extensions for the **.json** file and why to create a `.yml` file. To get you started with the latter, here is an easy-to-follow example: Create a file named `.aider.model.settings.yml` and add the following to it:

```yaml
- name: openai/MODEL_ID
  edit_format: diff
  use_repo_map: true
```

Use this template, replacing `MODEL_ID` with the exact **Model ID** found in the [GLBNXT Model Hub](https://docs.glbnxt.com/configure-glbnxt/ai-platform/model-hub).

### Troubleshooting

* **Model ID Mismatch**: If Cline fails to initialize, double-check that the key in **Model ID** matches the ID in the GLBNXT Model Hub exactly.
  * **Note:** to use glbnxt/Devstral Small 2, do not use the Model ID (glbnxt/devstral-small-2), but use the Model name glbnxt/Devstral Small 2.

For more information reach out to the [Aider Documentation Page](https://aider.chat/docs/).


---

# Agent Instructions: 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.glbnxt.com/tutorials/guides/coding/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.
