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?
Available SDKs
| Language | Package | Install | Dependencies |
|---|---|---|---|
| Python | ingate | pip install ingate | Zero (stdlib only) |
| TypeScript | @ingate/sdk | npm install @ingate/sdk | Zero (native fetch) |
| Go | ingate | go get github.com/thetrueshags/ingate/sdk/go/ingate | Zero (stdlib only) |
| Elixir | ingate | {:ingate, "~> 0.1.0"} | req, jason |
Quick Start
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
import { Ingate } from '@ingate/sdk';
const ig = new Ingate();
ig.ship({ provider: 'openai', model: 'gpt-4o', prompt: 'Hello', completion: 'Hi!' });
await ig.flush();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.
# 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:
| Method | Description |
|---|---|
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 Var | Description | Default |
|---|---|---|
INGATE_URL | Ingate gateway URL | https://api.ingateai.com |
INGATE_API_KEY | API key for authentication | none |
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.