pub struct ClientBuilder { /* private fields */ }Expand description
Builder for constructing a Client with custom configuration.
Implementations§
Source§impl ClientBuilder
impl ClientBuilder
Sourcepub fn base_url(self, url: impl Into<String>) -> Self
pub fn base_url(self, url: impl Into<String>) -> Self
Sets the API base URL (default: https://api.quantumencoding.ai).
Sourcepub fn timeout(self, timeout: Duration) -> Self
pub fn timeout(self, timeout: Duration) -> Self
Sets the request timeout for non-streaming requests (default: 120s).
Media generation endpoints (video, dubbing, 3D) can take 1–5 minutes.
For these, use Duration::from_secs(300) or longer. Alternatively,
use the async jobs API (create_job / poll_job) which doesn’t block.
Sourcepub fn app(self, app: impl Into<String>) -> Self
pub fn app(self, app: impl Into<String>) -> Self
Tags every request with the calling app’s identifier.
Sent as X-Quantum-App: <app> on every HTTP request (including streaming).
The server uses this to route requests through app-specific paywall,
quota, or dispatch logic — for example, the Recipe Box trial-paywall
gate on /qai/v1/chat.
Thin convenience wrapper around extra_header.
If both app(...) and extra_header("X-Quantum-App", ...) are set,
the value from app(...) wins.
Sourcepub fn extra_header(
self,
name: impl Into<String>,
value: impl Into<String>,
) -> Self
pub fn extra_header( self, name: impl Into<String>, value: impl Into<String>, ) -> Self
Adds an extra HTTP header to every request from this client.
Useful for app identification, request tagging, A/B routing, etc.
Standard headers (Authorization, X-API-Key) are managed by the
builder and cannot be overridden — passing either here causes
build to return an invalid_header error.
Header names and values are validated at build() time, not here.