Skip to main content
dyna AI Gateway logo

dyna AI Gateway

A server-side TypeScript library that puts a language model inside a business application. The application calls ask() for an answer or run() for an agent with tools; the gateway does the rest.

pnpm add dyna-ai-gateway zod
 Application / Agent                 dyna-ai-gateway                              LLM providers
┌──────────────────┐   ask()    ┌───────────────────────────────────────┐        ┌─────────────┐
│  business logic  │   run()    │  prompt assembly · history · memory   │  AI    │  OpenAI     │
│  HTTP, UI, jobs  │ ────────▶  │  knowledge base · tools · policies    │  SDK   │  Anthropic  │
│                  │ ◀────────  │  human gate · usage · guardrails      │ ─────▶ │  Google     │
│  userContext     │  events    │  trace                                │        │  Mistral    │
│  (authenticated) │  response  └──────────────────┬────────────────────┘        │  Bedrock    │
└──────────────────┘                               │ repository / adapter        └─────────────┘
                                                   ▼ interfaces
                                    in-memory · MongoDB · PostgreSQL · S3

No provider lock-in

OpenAI, Anthropic, Google, Mistral and Amazon Bedrock. The model is chosen per call through the profile.

Your data, your database

Every store is an interface. In-memory implementations are included.

Tools with a policy

defineTool: a function with a zod schema and a policy that allows, denies or holds each call.

A human in the loop

A run pauses on a tool call or on the final answer; resume() takes approve, edit or reject.

Spend in your code

Your usage adapter is asked before every model call and told what it used. The gateway holds no budget.

Testable without a key

The agent loop runs on a scripted model, so the tests need no provider.