Developer Platform
Unified SDKs Monorepo

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.

Jump to:Star on GitHub
Feature

3 Official Runtimes

TypeScript / Python / Go

Feature

Micro-Cent Precision

$0.000001 zero-drift billing

Feature

100% Type-Safe

Full IDE autocompletion & validation

Feature

Zero Runtime Bloat

Pure standard library in TS & Go

TypeScript & Node.js

npm v0.1.1

@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.

Zero DependenciesESM + CJSEdge-Ready100% Typed
Installation
npm install @e2x/sdk
Zero-drift billing engine
HMAC webhook signature validation
Adaptive 1s / 2s polling loop
inference.ts
import { 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

PyPI

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.

Python 3.9+Pydantic v2Sync & AsyncType-Checked
Installation
pip install e2x
Zero-drift billing engine
HMAC webhook signature validation
Adaptive 1s / 2s polling loop
inference.py
from 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

Go 1.21+

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.

Zero External DependenciesConcurrency-SafeDeep UnmarshalContext-Aware
Installation
go get github.com/e2xai/e2x-go
Zero-drift billing engine
HMAC webhook signature validation
Adaptive 1s / 2s polling loop
main.go
package 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())
}
Centralized Source

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.

packages/e2x-js
v0.1.1

TypeScript SDK • ESM/CJS build • Vitest suite • Webhook verifier

packages/e2x-python
PyPI

Python SDK • Pydantic v2 schemas • Pytest • Sync/Async HTTPX

packages/e2x-go
Go 1.21+

Go SDK • Pure standard library • Concurrency safe • Zero external deps

Engineering Standard

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.

01

Micro-Cent Financial Precision

1,000,000 µ¢ = $1.00 USD

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.
cost_usd = Decimal(cost_micro_cents) / Decimal(1_000_000)
02

Adaptive Polling Engine

1s Burst → 2s Steady

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.
interval = clamp(elapsed < 6s ? 1000ms : 2000ms, min=500ms, max=5000ms)
03

Industrial-Grade Resiliency

RFC 9110 + Full Jitter

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.
sleep = min(cap, random(0, base * 2 ^ attempt)) | respect Retry-After
04

Cryptographic HMAC-SHA256 Webhooks

Constant-Time Verification

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.
computed = HMAC_SHA256(signing_secret, `${timestamp}.${raw_body}`)
Quickstart

Start Building in 3 Minutes

Get up and running with the official E2X SDKs using your API key and favorite programming language.

Step 01

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.

Step 02

Install the SDK

Add the lightweight package to your TypeScript, Python, or Go application. All SDKs feature zero heavy dependencies and run everywhere.

Step 03

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.

Common Questions

Frequently Asked Questions