Official E2X SDKs
Production-grade, open-source SDKs for TypeScript, Python, and Go. One unified interface for 10+ generative AI models with sub-cent financial precision and zero-drift micro-cents.
3 Official Runtimes
TypeScript / Python / Go
Micro-Cent Precision
$0.000001 zero-drift billing
100% Type-Safe
Full IDE autocompletion & validation
Zero Runtime Bloat
Pure standard library in TS & Go
TypeScript & Node.js
@e2x/sdk • JavaScript / Bun / Deno
Universal, zero-dependency SDK for browsers, Node.js 18+, and Edge Runtimes (Cloudflare Workers, Vercel Edge). Strict TypeScript generics and stream updates.
npm install @e2x/sdkimport { E2X } from '@e2x/sdk';
const client = new E2X(); // reads E2X_API_KEY
const job = await client.run('google/nano-banana-pro', {
prompt: 'Neo Tokyo cyberpunk tiger, 8k cinematic render',
}, {
onUpdate: (snap) => console.log(`Progress: ${snap.progress}%`),
});
console.log('Result URL:', job.output?.outputs?.[0]?.url);
console.log(`Billed: $${job.cost_usd.toFixed(4)}`);Python
e2x • Python 3.9+ / AsyncIO
Idiomatic, Pydantic-validated SDK with native sync and async client support. Optimized for machine learning workflows, FastAPI services, and LangChain pipelines.
pip install e2xfrom e2x import E2X
client = E2X()
job = client.run(
"google/nano-banana-pro",
{"prompt": "Neo Tokyo cyberpunk tiger, 8k cinematic render"},
on_update=lambda j: print(f"Progress: {j.progress}%"),
)
print(f"URL: {job.output_urls[0]} | Cost: ${job.cost_usd:.4f}")Go
github.com/e2xai/e2x-go • Go 1.21+ / Pure Stdlib
Ultra-lean Go SDK built entirely on the standard library with zero external dependencies. Thread-safe client, context cancellation, and custom unmarshaling.
go get github.com/e2xai/e2x-gopackage main
import (
"context"
"fmt"
"github.com/e2xai/e2x-go"
)
func main() {
ctx := context.Background()
client, _ := e2x.New() // reads E2X_API_KEY
job, _ := client.Run(ctx, e2x.RunParams{
Model: "google/nano-banana-pro",
Input: map[string]any{"prompt": "Neo Tokyo cyberpunk tiger"},
})
fmt.Println("Result:", job.OutputURL())
}Unified SDKs Monorepo
All three official E2X SDKs live in a centralized monorepo with uniform test suites, cross-language parity verification, continuous integration, and unified issue tracking.
TypeScript SDK • ESM/CJS build • Vitest suite • Webhook verifier
Python SDK • Pydantic v2 schemas • Pytest • Sync/Async HTTPX
Go SDK • Pure standard library • Concurrency safe • Zero external deps
The 4 Pillars of E2X SDK Design
Every official E2X SDK adheres to the same architectural specification, ensuring consistent behavior, predictable error handling, and audit-grade financial accuracy across every stack.
Micro-Cent Financial Precision
Zero IEEE 754 floating point drift. All cost accounting is calculated using integer micro-cents to guarantee bitwise deterministic billing balance tracking.
- Exact 64-bit integer arithmetic eliminates fractional pennies drift over millions of requests.
- Native dual representations: SDK models provide both integer cost_micro_cents and formatted cost_usd.
- Auditable billing records with zero variance between your client receipts and the backend ledger.
Adaptive Polling Engine
Optimized dual-phase polling loop that delivers instant sub-second completions without exhausting client CPU or triggering upstream rate throttles.
- Initial burst: 1-second high-frequency poll for ultra-fast models (e.g. text-to-image, instant sketches).
- Smooth transition to 2-second steady-state cadence for long-running jobs (video rendering, multi-step upscale).
- Pluggable custom onUpdate progress listener for real-time frontend status updates and loading bars.
Industrial-Grade Resiliency
Compliant HTTP retry policies with RFC 9110 Retry-After header parsing and exponential backoff decorated with full decorrelated randomized jitter.
- Survives transient network disconnects, HTTP 429 rate limit pressure, and server gateway 503s.
- Decoupled backoff curves prevent "thundering herd" retry storms against upstream model providers.
- Configurable max retries, custom timeouts, and cancellation token integration across all runtimes.
Cryptographic HMAC-SHA256 Webhooks
Production-grade asynchronous job ingestion. All webhooks are authenticated with cryptographic HMAC-SHA256 digests over a timestamped raw payload.
- Signed payload format: {timestamp}.{raw_body} prevents payload modification and man-in-the-middle attacks.
- Strict 5-minute replay window tolerance eliminates replay attacks and stale packet injection.
- Timing-safe constant-time string comparison protects against side-channel timing analysis.
Start Building in 3 Minutes
Get up and running with the official E2X SDKs using your API key and favorite programming language.
Create Account & Get API Key
Sign up in seconds and generate your secret API key from the developer settings. Store it safely in your environment as E2X_API_KEY.
Install the SDK
Add the lightweight package to your TypeScript, Python, or Go application. All SDKs feature zero heavy dependencies and run everywhere.
Run Inference & Track Costs
Call client.run() with your desired model slug and input parameters. Enjoy sub-cent micro-cent precision, stream updates, and instant outputs.
Ready to deploy generative AI to production?
Monitor active jobs, manage API credentials, and review balance usage in your dashboard.