Clarify OpenAI client timeout precedence

This commit is contained in:
2026-07-26 17:42:44 +00:00
parent d86b65adad
commit eb6dfb19b0
5 changed files with 65 additions and 30 deletions

View File

@@ -10,13 +10,14 @@ format and protocol behavior.
## Construction
`NewOpenAICompatibleClient` validates a non-empty configured base URL, records
an optional default model, and establishes the default timeout. A non-positive
configured timeout uses the internal default.
an optional default model, and resolves one base timeout. A supplied client with
a non-zero timeout supplies that base; otherwise a positive configured timeout
is used, then the internal default.
When callers supply an `http.Client`, construction clones it rather than
mutating the caller's instance. A supplied client with no timeout receives the
resolved default in the clone; a supplied non-zero timeout is retained. The
client stores the trimmed base URL, default model, timeout, and cloned client.
resolved base timeout in the clone. The client stores the trimmed base URL,
default model, and cloned client.
## Generate Flow
@@ -28,7 +29,7 @@ client stores the trimmed base URL, default model, timeout, and cloned client.
request;
4. prefer a direct API key, otherwise resolve the configured key environment
variable;
5. derive a request HTTP client when an explicit timeout changes the configured
5. derive a request HTTP client only when an explicit timeout changes the base
client;
6. execute the request, reject non-success status responses without returning
provider response bodies; and