Skip to content

Commit

Permalink
feat: align default env keys with js
Browse files Browse the repository at this point in the history
  • Loading branch information
louisjoecodes committed Dec 16, 2024
1 parent 9e38ea6 commit 8b7d1ab
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ from elevenlabs import play
from elevenlabs.client import ElevenLabs

client = ElevenLabs(
api_key="YOUR_API_KEY", # Defaults to ELEVEN_API_KEY
api_key="YOUR_API_KEY", # Defaults to ELEVEN_API_KEY or ELEVENLABS_API_KEY
)

audio = client.generate(
Expand All @@ -70,7 +70,7 @@ List all your available voices with `voices()`.
from elevenlabs.client import ElevenLabs

client = ElevenLabs(
api_key="YOUR_API_KEY", # Defaults to ELEVEN_API_KEY
api_key="YOUR_API_KEY", # Defaults to ELEVEN_API_KEY or ELEVENLABS_API_KEY
)

response = client.voices.get_all()
Expand All @@ -88,7 +88,7 @@ from elevenlabs import Voice, VoiceSettings, play
from elevenlabs.client import ElevenLabs

client = ElevenLabs(
api_key="YOUR_API_KEY", # Defaults to ELEVEN_API_KEY
api_key="YOUR_API_KEY", # Defaults to ELEVEN_API_KEY or ELEVENLABS_API_KEY
)

audio = client.generate(
Expand All @@ -113,7 +113,7 @@ from elevenlabs.client import ElevenLabs
from elevenlabs import play

client = ElevenLabs(
api_key="YOUR_API_KEY", # Defaults to ELEVEN_API_KEY
api_key="YOUR_API_KEY", # Defaults to ELEVEN_API_KEY or ELEVENLABS_API_KEY
)

voice = client.clone(
Expand All @@ -136,7 +136,7 @@ from elevenlabs.client import ElevenLabs
from elevenlabs import stream

client = ElevenLabs(
api_key="YOUR_API_KEY", # Defaults to ELEVEN_API_KEY
api_key="YOUR_API_KEY", # Defaults to ELEVEN_API_KEY or ELEVENLABS_API_KEY
)

audio_stream = client.generate(
Expand All @@ -159,7 +159,7 @@ from elevenlabs.client import ElevenLabs
from elevenlabs import stream

client = ElevenLabs(
api_key="YOUR_API_KEY", # Defaults to ELEVEN_API_KEY
api_key="YOUR_API_KEY", # Defaults to ELEVEN_API_KEY or ELEVENLABS_API_KEY
)

def text_stream():
Expand Down Expand Up @@ -189,7 +189,7 @@ import asyncio
from elevenlabs.client import AsyncElevenLabs

eleven = AsyncElevenLabs(
api_key="MY_API_KEY" # Defaults to ELEVEN_API_KEY
api_key="MY_API_KEY" # Defaults to ELEVEN_API_KEY or ELEVENLABS_API_KEY
)

async def print_models() -> None:
Expand Down
4 changes: 2 additions & 2 deletions src/elevenlabs/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def __init__(
*,
base_url: typing.Optional[str] = None,
environment: ElevenLabsEnvironment = ElevenLabsEnvironment.PRODUCTION,
api_key: typing.Optional[str] = os.getenv("ELEVEN_API_KEY"),
api_key: typing.Optional[str] = os.getenv("ELEVENLABS_API_KEY") or os.getenv("ELEVEN_API_KEY"),
timeout: typing.Optional[float] = None,
follow_redirects: typing.Optional[bool] = True,
httpx_client: typing.Optional[httpx.Client] = None,
Expand Down Expand Up @@ -167,7 +167,7 @@ def __init__(
*,
base_url: typing.Optional[str] = None,
environment: ElevenLabsEnvironment = ElevenLabsEnvironment.PRODUCTION,
api_key: typing.Optional[str] = os.getenv("ELEVEN_API_KEY"),
api_key: typing.Optional[str] = os.getenv("ELEVENLABS_API_KEY") or os.getenv("ELEVEN_API_KEY"),
timeout: typing.Optional[float] = None,
follow_redirects: typing.Optional[bool] = True,
httpx_client: typing.Optional[httpx.AsyncClient] = None,
Expand Down
2 changes: 1 addition & 1 deletion src/elevenlabs/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __init__(
*,
base_url: typing.Optional[str] = None,
environment: ElevenLabsEnvironment = ElevenLabsEnvironment.PRODUCTION,
api_key: typing.Optional[str] = os.getenv("ELEVEN_API_KEY"),
api_key: typing.Optional[str] = os.getenv("ELEVENLABS_API_KEY") or os.getenv("ELEVEN_API_KEY"),
timeout: typing.Optional[float] = 60,
httpx_client: typing.Optional[httpx.Client] = None
):
Expand Down

0 comments on commit 8b7d1ab

Please # to comment.