SDKs

Lightweight SDKs for shipping LLM exchange traces to Ingate, observability, evaluation, and cost tracking for any LLM application.

How It Works

The SDKs implement the sidecar pattern. Your app calls the LLM provider directly (OpenAI, Anthropic, Ollama, etc.), and after each call you ship() the exchange trace to Ingate. The SDK batches traces in memory and sends them in the background. Ingate handles extraction, logging, evals, cost tracking, and dashboards.

Each SDK wraps the REST Ingestion API, so exchanges shipped through an SDK go through the same pipeline as proxy traffic.

Do you need an SDK?

SDKs are for the sidecar pattern. If you can change your provider client's base URL, the transparent proxy captures exchanges automatically and needs no SDK at all. See the Quickstart.

Available SDKs

LanguagePackageInstallDependencies
Pythoningatepip install ingateZero (stdlib only)
TypeScript@ingate/sdknpm install @ingate/sdkZero (native fetch)
Goingatego get github.com/thetrueshags/ingate/sdk/go/ingateZero (stdlib only)
Elixiringate{:ingate, "~> 0.1.0"}req, jason

Quick Start

Python

python
from ingate import Ingate, Exchange
ig = Ingate()  # reads INGATE_URL + INGATE_API_KEY from env
ig.ship(Exchange(provider="openai", model="gpt-4o", prompt="Hello", completion="Hi!"))
ig.flush()

TypeScript

ts
import { Ingate } from '@ingate/sdk';
const ig = new Ingate();
ig.ship({ provider: 'openai', model: 'gpt-4o', prompt: 'Hello', completion: 'Hi!' });
await ig.flush();

Go

main.go
ig := ingate.New()
ig.Ship(ingate.Exchange{Provider: "openai", Model: "gpt-4o", Prompt: "Hello", Completion: "Hi!"})
ig.Flush()
ig.Close()

Elixir

The Elixir SDK requires starting Ingate.Worker in your supervisor before shipping exchanges.

example.exs
# Elixir (after starting Ingate.Worker in your supervisor)
Ingate.ship(%Ingate.Exchange{provider: "openai", model: "gpt-4o", prompt: "Hello", completion: "Hi!"})
Ingate.flush()

API Surface

Each SDK provides the same core methods:

MethodDescription
ship()Fire-and-forget: queues the exchange for background batch shipping
ingest()Synchronous: blocks until the exchange is accepted
ingest_batch()Synchronous: ships up to 100 exchanges in one request
flush()Blocks until the background queue is drained
health()Checks gateway connectivity

Configuration

All SDKs read from environment variables by default:

Env VarDescriptionDefault
INGATE_URLIngate gateway URLhttps://api.ingateai.com
INGATE_API_KEYAPI key for authenticationnone

Constructor and config overrides always win over environment variables.

Two Shipping Modes

Full-Body Mode (Recommended)

Send raw request_body and response_body. Ingate extracts model, tokens, prompt, and completion server-side.

Pre-Extracted Mode

Send just the fields you care about (prompt, completion, input_tokens, etc.), a lighter payload, and you control extraction.