Client configuration
Client / AsyncClient — construction, env vars, timeout, retries, per-request overrides.
Sync client
from layerlens import Client
client = Client() # picks up LAYERLENS_STRATIX_API_KEY
client = Client(api_key="your-key") # explicitAsync client
from layerlens import AsyncClient
client = AsyncClient()Aliases
For backward compatibility:
from layerlens import Client, AsyncClient # primary
from layerlens import Client, AsyncClient # aliases
from layerlens import Atlas, AsyncAtlas # legacy aliases
from layerlens import PublicClient, AsyncPublicClientConstructor parameters
Client(api_key, base_url, timeout, max_retries) and AsyncClient(...):
api_key
str | None
yes*
None
LayerLens API key
base_url
str | httpx.URL | None
no
LayerLens API URL
Custom base URL
timeout
float | httpx.Timeout | None
no
10 minutes (600s)
Timeout config
max_retries
int
no
2
Max retries (429, 5xx)
*Required unless set via env var.
Environment variables
LAYERLENS_STRATIX_API_KEY
(required)
Primary key env var
LAYERLENS_STRATIX_BASE_URL
https://api.layerlens.ai/api/v1
Override for self-hosted / staging
LAYERLENS_ATLAS_API_KEY
—
Legacy alias
LAYERLENS_ATLAS_BASE_URL
—
Legacy alias
Timeout
Per-request override
.with_options() returns a copy of the client with overridden options:
Retries
The client retries on 429, 500, 502, 503, 504 with exponential backoff and respects Retry-After:
See also
Errors — exception hierarchy
Last updated
Was this helpful?