docs: make a custom System One base URL obvious - #5
Merged
Merged
Conversation
Callers could already override the host, but docs and examples hid it. Reject a blank or non-http URL at build, add a mock example, and record mock-HTTP bench numbers. No hot-path change. Co-authored-by: hexuria <hexuria@users.noreply.github.com>
codeitlikemiley
commented
Sep 24, 2026
codeitlikemiley
left a comment
Owner
Author
There was a problem hiding this comment.
Comment. No code change requested.
The override works. normalize_base_url runs once inside Config::resolve at build. system_one and models both use format!("{}{path}", config.base_url). The only src/ change is src/config.rs. Auth, JSON body, retry, and timeout stay as they are when build succeeds.
Checked on 9a17634 with rustc 1.98.1. cargo test --lib config:: passed (trailing slash and whitespace, blank, ftp, relative). custom_base_url_serves_system_one_and_models and same_origin_307_is_followed passed with --features mock.
Not blocking.
- A base URL that contains
?or#is accepted. The join is still string append, so/v1/systemonelands in the query or the fragment. That join is unchanged frommain. Rejecting those strings atbuildwould be new policy. docs/audit-2026-09-24.mdsays the example locks a path prefix. The contract test does (/gateway/v1/...).examples/custom_base_url.rsmounts/v1/systemoneand/v1/modelson the wiremock origin.examples/README.mdnow says live mode usesTYPESAFE_BASE_URLor elsehttps://api.typesafe.ai.custom_base_urlreturnsError::Sdkwhen that variable is unset. The other examples still fall back.- Common failure 10 says the base URL is the server root. README and the contract test also allow a path prefix such as
/gateway. - The runnable example does not call
.model(). The README and AGENTS snippets do. Live mode therefore sendsjev-latest. - The audit says no example called
.base_urlbefore this PR.examples/support/harness.rsandexamples/blocking_triage.rsalready did, against wiremock. - Bench numbers in the audit were not reproduced here. The harness binds wiremock on
127.0.0.1, disables retries, and does not readTYPESAFE_API_KEY. CI compiles the bench and does not run it. - An accepted
httporhttpsURL still matches the Python 0.6.0 string join. Rust now rejects an empty or non-http(s) base atbuild. Python 0.6.0 only doesrstrip("/").
No Bugbot threads. New module-doc comments are not a reason to change the code.
Path prefixes stay allowed and are locked by the contract test, not the example. Live custom_base_url requires TYPESAFE_BASE_URL and sets jev-latest explicitly. Docs warn that query, fragment, and a trailing /v1 are joined as text. Co-authored-by: hexuria <hexuria@users.noreply.github.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.
Callers could already override the host, but docs and examples hid it. Reject a blank or non-http URL at build, add a mock example, and record mock-HTTP bench numbers. No hot-path change.