mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 09:44:59 +00:00
copy
This commit is contained in:
parent
ecfb133de2
commit
47d5b66986
1 changed files with 35 additions and 20 deletions
|
@ -13,24 +13,23 @@ Aider lets you specify API keys in a few ways:
|
|||
- In a `.env` file
|
||||
- In your `.aider.conf.yml` config file
|
||||
|
||||
### OpenAI and Anthropic
|
||||
---
|
||||
|
||||
## OpenAI and Anthropic
|
||||
|
||||
Aider has special support for providing
|
||||
OpenAI and Anthropic API keys
|
||||
via dedicated switches and configuration options.
|
||||
Settings keys for other providers works a bit differently, see below.
|
||||
|
||||
#### Command line
|
||||
|
||||
You can set OpenAI and Anthropic API keys via
|
||||
[command line switches](/docs/config/options.html#api-keys-and-settings)
|
||||
`--openai-api-key` and `--anthropic-api-key`.
|
||||
|
||||
You can also set those API keys via special entries in the
|
||||
[yaml config file](/docs/config/aider_conf.html), like this:
|
||||
|
||||
```yaml
|
||||
openai-api-key: <key>
|
||||
anthropic-api-key: <key>
|
||||
```
|
||||
#### Environment variables or .env file
|
||||
|
||||
You can also store them in environment variables or a
|
||||
[.env file](/docs/config/dotenv.html), which also works
|
||||
|
@ -41,16 +40,43 @@ OPENAI_API_KEY=<key>
|
|||
ANTHROPIC_API_KEY=<key>
|
||||
```
|
||||
|
||||
#### Yaml config file
|
||||
You can also set those API keys via special entries in the
|
||||
[yaml config file](/docs/config/aider_conf.html), like this:
|
||||
|
||||
```yaml
|
||||
openai-api-key: <key>
|
||||
anthropic-api-key: <key>
|
||||
```
|
||||
|
||||
|
||||
---
|
||||
|
||||
## Other API providers
|
||||
|
||||
All other LLM providers can use one of these other methods to set their API keys.
|
||||
|
||||
### API keys on the command line
|
||||
#### Command line
|
||||
{: .no_toc }
|
||||
|
||||
Use `--api-key provider=<key>` which has the effect of setting the environment variable `PROVIDER_API_KEY=<key>`. So `--api-key gemini=xxx` would set `GEMINI_API_KEY=xxx`.
|
||||
|
||||
### API keys in .aider.conf.yml
|
||||
#### Environment variables or .env file
|
||||
{: .no_toc }
|
||||
|
||||
You can set API keys in environment variables.
|
||||
The [.env file](/docs/config/dotenv.html)
|
||||
is a great place to store your API keys and other provider API environment variables:
|
||||
|
||||
```bash
|
||||
GEMINI_API_KEY=foo
|
||||
OPENROUTER_API_KEY=bar
|
||||
DEEPSEEK_API_KEY=baz
|
||||
```
|
||||
|
||||
#### Yaml config file
|
||||
|
||||
|
||||
You can also set API keys in the
|
||||
[`.aider.conf.yml` file](/docs/config/aider_conf.html)
|
||||
via the `api-key` entry:
|
||||
|
@ -62,14 +88,3 @@ api-key:
|
|||
- deepseek=baz # Sets env var DEEPSEEK_API_KEY=baz
|
||||
```
|
||||
|
||||
### API keys in a .env file
|
||||
{: .no_toc }
|
||||
|
||||
The [.env file](/docs/config/dotenv.html)
|
||||
is a great place to set API keys and other provider API environment variables:
|
||||
|
||||
```bash
|
||||
GEMINI_API_KEY=foo
|
||||
OPENROUTER_API_KEY=bar
|
||||
DEEPSEEK_API_KEY=baz
|
||||
```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue