forked from phoenix/litellm-mirror
fix(main.py): check for ANTHROPIC_BASE_URL in environment
Fixes https://github.com/BerriAI/litellm/issues/4803
This commit is contained in:
parent
9dc10f97a6
commit
576cccaade
2 changed files with 3 additions and 0 deletions
|
@ -22,6 +22,7 @@ Anthropic API fails requests when `max_tokens` are not passed. Due to this litel
|
|||
import os
|
||||
|
||||
os.environ["ANTHROPIC_API_KEY"] = "your-api-key"
|
||||
# os.environ["ANTHROPIC_API_BASE"] = "" # [OPTIONAL] or 'ANTHROPIC_BASE_URL'
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
|
|
@ -1487,6 +1487,7 @@ def completion(
|
|||
api_base
|
||||
or litellm.api_base
|
||||
or get_secret("ANTHROPIC_API_BASE")
|
||||
or get_secret("ANTHROPIC_BASE_URL")
|
||||
or "https://api.anthropic.com/v1/complete"
|
||||
)
|
||||
response = anthropic_text_completions.completion(
|
||||
|
@ -1512,6 +1513,7 @@ def completion(
|
|||
api_base
|
||||
or litellm.api_base
|
||||
or get_secret("ANTHROPIC_API_BASE")
|
||||
or get_secret("ANTHROPIC_BASE_URL")
|
||||
or "https://api.anthropic.com/v1/messages"
|
||||
)
|
||||
response = anthropic_chat_completions.completion(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue