Conversation
The official Typesafe SDKs read three variables: TYPESAFE_API_KEY, TYPESAFE_BASE_URL, and TYPESAFE_DEFAULT_MODEL. This client read the first and ignored the other two, so a process already configured for the Python or JavaScript SDK -- pointed at a staging base, or pinned to a versioned model id -- silently got production and jev-latest here, which is the worst way to be inconsistent: it works. Providers declare the names with base_url_env and default_model_env, both nil by default so a hand-written provider keeps the old behaviour. OpenRouter gets the matching pair under its own prefix. Precedence is the same for both: an explicit argument, then the environment, then the built-in default. A blank value counts as unset, so an exported-but-empty variable does not point the client at "". A model that comes from the environment goes through the provider's aliases like any other. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The official Typesafe SDKs read three variables:
TYPESAFE_API_KEY,TYPESAFE_BASE_URLandTYPESAFE_DEFAULT_MODEL. This client read the first and ignored the other two.So a process already configured for the Python or JavaScript SDK — pointed at a staging base, or pinned to a versioned model id — silently got production and
jev-latesthere. Which is the worst way to be inconsistent: it works.Providers declare the names with
base_url_envanddefault_model_env, bothnilby default so a hand-written provider keeps the old behaviour. OpenRouter gets the matching pair under its own prefix.Precedence is the same for both: an explicit argument, then the environment, then the built-in default. A blank value counts as unset, so an exported-but-empty variable doesn't point the client at
"". A model that comes from the environment goes through the provider's aliases like any other.Tests
test/provider_env_test.rb, 12 cases, including that one provider's variable never reaches another.Draft: part of a security and API-coverage audit, opened for reference rather than as a request for immediate review. Independent of the other branches, each off
main. Suite green on Ruby 3.2.11, 3.3.8 and 3.4.8.🤖 Generated with Claude Code