Skip to content

Commit c15fb16

Browse files
authored
Merge pull request #1779 from dnnspaul/main
Enable usage of OpenAI like APIs
2 parents d268db5 + 250870a commit c15fb16

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

docs/docs/usage-guide/changing_a_model.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,23 @@ You can give parameters via a configuration file, or from environment variables.
1616
See [litellm documentation](https://litellm.vercel.app/docs/proxy/quick_start#supported-llms) for the environment variables needed per model, as they may vary and change over time. Our documentation per-model may not always be up-to-date with the latest changes.
1717
Failing to set the needed keys of a specific model will usually result in litellm not identifying the model type, and failing to utilize it.
1818

19+
### OpenAI like API
20+
To use an OpenAI like API, set the following in your `.secrets.toml` file:
21+
22+
```toml
23+
[openai]
24+
api_base = "https://api.openai.com/v1"
25+
api_key = "sk-..."
26+
```
27+
28+
or use the environment variables (make sure to use double underscores `__`):
29+
30+
```bash
31+
OPENAI__API_BASE=https://api.openai.com/v1
32+
OPENAI__KEY=sk-...
33+
```
34+
35+
1936
### Azure
2037

2138
To use Azure, set in your `.secrets.toml` (working from CLI), or in the GitHub `Settings > Secrets and variables` (working from GitHub App or GitHub Action):

pr_agent/algo/ai_handlers/litellm_ai_handler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ def __init__(self):
5959
litellm.api_version = get_settings().openai.api_version
6060
if get_settings().get("OPENAI.API_BASE", None):
6161
litellm.api_base = get_settings().openai.api_base
62+
self.api_base = get_settings().openai.api_base
6263
if get_settings().get("ANTHROPIC.KEY", None):
6364
litellm.anthropic_key = get_settings().anthropic.key
6465
if get_settings().get("COHERE.KEY", None):

0 commit comments

Comments
 (0)