CLIENTS
Async client
Configure asynchronous System One requests, discover available models, and manage an AsyncTypeSafeClient instance.
typesafe_sdk.AsyncTypeSafeClient
AsyncTypeSafeClient(
*,
api_key: str | None = None,
model: str | None = None,
retry: RetryPolicy | None = None,
timeout: float
| httpx2.Timeout
| None = None,
headers: Mapping[str, str] | None = None,
transport: httpx2.AsyncBaseTransport
| None = None,
http_client: httpx2.AsyncClient
| None = None,
base_url: str | None = None,
)Asynchronous client for System One requests and model discovery. Constructor options take precedence over the corresponding environment variables. This recipe preserves the public member names; it does not instantiate a client.
Parameters
| Name | Type / default | Behavior |
|---|---|---|
api_key | str | None = None | Uses TYPESAFE_API_KEY when omitted. A missing key is an error. |
model | str | None = None | Uses TYPESAFE_DEFAULT_MODEL when omitted; individual requests can select a model. |
retry | RetryPolicy | None = None | Controls retry behavior. A policy with max_retries=0 disables retries. |
timeout | float | Timeout | None = None | Inherits a supplied HTTP client timeout, otherwise the SDK default applies. |
headers | Mapping[str, str] | None | Additional headers for requests. |
transport | AsyncBaseTransport | None | A custom asynchronous transport; mutually exclusive with http_client. |
http_client | AsyncClient | None | A supplied asynchronous client, closed when the SDK client closes. |
base_url | str | None = None | Uses TYPESAFE_BASE_URL when omitted. |
Constructor failures
The public contract reports TypeSafeError for a missing key or invalid timeout, and ValueError when both a transport and HTTP client are supplied.
Members
models
Cached AsyncModels resource. Use its list method to discover models.
system_one
await client.system_one(
state,
questions,
model=None,
retry=None,
timeout=None,
extra_headers=None,
extra_body=None,
response_model=None,
)Ready to copy
Returns a SystemOneResponse, or the response type requested through response_model. Required state and questions define the decision input.
aclose
Closes the asynchronous client and its managed HTTP resources. Await cleanup when the application is finished with the client.
TypeSafe console