You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Environment API key is captured at import time in sync and async clients #33
The generated Speechify and AsyncSpeechify constructors evaluate os.getenv("SPEECHIFY_API_KEY") in their parameter defaults at module import time. Consequently:
Import the SDK with the variable unset, then load it with dotenv/a secret manager: constructing either client without an explicit token still raises ApiError.
Import with key A, update the environment to key B, then construct a client: its HTTP Authorization header still uses key A.
Import with a key, remove it, then construct a new client: the deleted import-time key is still used.
I tested a local proof of concept with 12 offline sync/async public-client cases: late, replaced, removed and absent environment keys plus explicit-string/callable controls. Six fail on the current source; all pass after moving environment lookup into the constructors, and the full suite passes (78 passed, four skipped). Request headers are checked with httpx.MockTransport; no real keys, live API calls, or audio are involved.
This is generated code. Per the README and AGENTS.md, any SDK patch here is a proof of concept for a generator/source-definition fix, not a durable merge-ready change. I can link the tested patch for that discussion. Developed with AI assistance and verified locally.
Activity