SDK Overview
Python, TypeScript and Go, each generated from the same OpenAPI specification with Fern. Method and option names follow the conventions of the language you are working in. The API underneath is the same one.
| SDK | Package | Min Version |
|---|---|---|
| Python | levelfour | Python 3.11+ |
| TypeScript | levelfour | Node.js 22+ |
| Go | github.com/LevelFourAI/levelfour-go | Go 1.24+ |
l4 api sends an authenticated request to any of them from a shell.The behavior all three share lives on the page that owns it:
- The API key goes in the constructor, and falls back to the
LEVELFOUR_API_KEYenvironment variable when you leave it out. Authentication has key formats, scopes and rotation. - A typed error hierarchy maps HTTP status codes to specific exception classes. Error handling has the status table, and the failures each client retries before you ever see them.
- Auto-pagination iterators walk large result sets. Pagination has the response envelope and the iteration forms.
- Webhook signature verification using HMAC-SHA256 (Standard Webhooks). Webhooks has the header contract, the algorithm and the timestamp tolerance.
Constructor options
The same settings in every SDK, under each language's own name.
| Option | Python | TypeScript | Go | Default |
|---|---|---|---|---|
| API Key | api_key | apiKey | 1st positional arg | LEVELFOUR_API_KEY env var |
| Base URL | base_url | baseURL | levelfour.WithBaseURL() | https://api.levelfour.ai |
| Timeout | timeout | timeoutInSeconds | levelfour.WithHTTPClient() | 30s |
| Max Retries | max_retries | maxRetries | levelfour.WithMaxRetries() | 2 |
| HTTP Client | http_client | fetch | levelfour.WithHTTPClient() | Built-in |
Timeout on the http.Client you hand to levelfour.WithHTTPClient(). The Go SDK page has the example.Sub-clients
Each client hangs the resources off a sub-client. The names follow the language.
| Sub-Client | Python | TypeScript | Go |
|---|---|---|---|
| Recommendations | client.recommendations | client.recommendations | client.Recommendations |
| Recommendations Audit | client.recommendations.audit | client.recommendations.audit | client.Recommendations.Audit |
| Costs | client.costs | client.costs | client.Costs |
| Providers | client.providers | client.providers | client.Providers |
| API Keys | client.api_keys | client.apiKeys | client.APIKeys |
| Webhooks | client.webhooks | client.webhooks | client.Webhooks |
| Auth | client.auth | client.auth | client.Auth |
Next
- Python, TypeScript and Go each carry the install command, the full constructor and the per-request options
- Quickstart is install, key, first call
- Resources is every method with its parameters and response shapes, in Python, TypeScript and Go
- API reference is the REST surface the clients are generated from
- CLI is the same data from the terminal
Enterprise SSO (SAML)
Sign your team in with your own identity provider over SAML 2.0: the values you exchange with LevelFour, the attributes your IdP must send, and how to set it up in Google Workspace.
Python SDK
The Python client for the LevelFour API: the sync and async constructors, the options they take, and how to override them for one call.