SDKs

SDK Overview

Available SDKs

LevelFour provides official SDKs in three languages. All SDKs are generated from the same OpenAPI specification using Fern and share consistent patterns:

  • Constructor-level authentication with API key and environment variable fallback
  • Typed error hierarchy mapping HTTP status codes to specific exception classes
  • Auto-pagination iterators for large result sets
  • Webhook signature verification using HMAC-SHA256 (Standard Webhooks)
  • Configurable retries for transient failures (2 retries by default)
  • 30-second request timeout by default
SDKPackageMin Version
PythonlevelfourPython 3.11+
TypeScriptlevelfourNode.js 22+
Gogithub.com/LevelFourAI/levelfour-goGo 1.24+

Constructor Options

All SDK constructors accept the same core options:

OptionPythonTypeScriptGoDefault
API Keyapi_keyapiKey1st positional argLEVELFOUR_API_KEY env var
Base URLbase_urlbaseURLlevelfour.WithBaseURL()https://api.levelfour.ai
TimeouttimeouttimeoutInSecondslevelfour.WithHTTPClient()30s
Max Retriesmax_retriesmaxRetrieslevelfour.WithMaxRetries()2
HTTP Clienthttp_clientfetchlevelfour.WithHTTPClient()Built-in

Sub-Clients

Every SDK client exposes the same set of resource sub-clients:

Sub-ClientPythonTypeScriptGo
Recommendationsclient.recommendationsclient.recommendationsclient.Recommendations
Recommendations Auditclient.recommendations.auditclient.recommendations.auditclient.Recommendations.Audit
Costsclient.costsclient.costsclient.Costs
Providersclient.providersclient.providersclient.Providers
API Keysclient.api_keysclient.apiKeysclient.APIKeys
Webhooksclient.webhooksclient.webhooksclient.Webhooks
Authclient.authclient.authclient.Auth