# Connect Aider to an OpenAI-Compatible API

Launch Aider with `OPENAI_API_BASE=https://api.promptavenue.com/v1`, your PromptAvenue API key, and an Uncensored model ID prefixed with `openai/`. In a sample Git repository, ask what `len([1, 2, 3])` returns in Ask mode and check for `3`.

[Model pricing](https://promptavenue.com/pricing) · [Run the API quickstart](https://promptavenue.com/docs/quickstart)

## What you need

- A [PromptAvenue account](https://api.promptavenue.com/sign-up?utm_source=docs&utm_medium=guide&utm_campaign=aider) with API balance.
- Aider installed and available as `aider`. If installing Aider with pip, use Python 3.10, 3.11, or 3.12 in a virtual environment.
- Bash or Zsh, and a sample Git repository.

## 1. Create a PromptAvenue API key

In the PromptAvenue dashboard, open the API keys page and select **Create API key**. Copy the full key when it appears.

## 2. Set `OPENAI_API_BASE` and launch Aider

In your sample repository, paste the PromptAvenue key at the hidden prompt.

```sh
printf 'PromptAvenue API key: '
IFS= read -rs PROMPTAVENUE_API_KEY
printf '\n'
```

Start Aider with the API base URL, key, and OpenAI-compatible model. The `openai/` prefix selects Aider's provider. The part after it is the PromptAvenue model ID.

```sh
OPENAI_API_BASE='https://api.promptavenue.com/v1' \
OPENAI_API_KEY="${PROMPTAVENUE_API_KEY:?Set your PromptAvenue API key first}" \
aider --model openai/deepseek-v4.1-flash-uncensored --chat-mode ask
```

## 3. Verify the connection in Ask mode

At Aider's prompt, ask the following question.

> What does `len([1, 2, 3])` return in Python? Answer in one sentence.

Expect a reply that says the result is `3`.

## Common errors

| Symptom | What to check |
| --- | --- |
| Authentication error | Check that you entered the PromptAvenue key in the same shell that launches Aider. |
| Route or model error | Check that `OPENAI_API_BASE` ends in `/v1` and that the model argument includes `openai/` followed by the exact ID. |
| Unknown-model metadata warning | Send the verification prompt. If you get a reply, the connection works. Check the provider's published limits before overriding model metadata. |
| Balance or rate-limit error | Check the dashboard balance if the error mentions funds. For rate limits, wait before retrying. |
