Skip to main content
The Flint AI TypeScript SDK supports the same integrations as the Python SDK. Standard LLM clients use wrap(), while Google ADK uses a dedicated plugin.

OpenAI

Wrap an OpenAI client to route completions through the guardrails proxy.
After wrapping, use the client exactly as before — the SDK redirects traffic transparently.

Anthropic

Wrap an Anthropic client the same way.

Google GenAI

Wrap a GoogleGenAI client. Set your Gemini key the way you normally would (shown here on the client). The SDK does not require any additional LLM provider key of its own.
The SDK normalizes the gateway URL with a trailing slash for Google GenAI — do not add one yourself.

LangChain

wrap() auto-detects LangChain chat models, extracts the underlying SDK client, and applies guardrails routing. Supported models:
  • ChatOpenAI (from @langchain/openai)
  • ChatAnthropic (from @langchain/anthropic)
  • ChatGoogleGenerativeAI (from @langchain/google-genai)

Google ADK

ADK agents lazily create their GenAI client at runtime, so wrap() cannot be used. Use ADKGuardrailsPlugin to configure guardrails routing at the agent level:
The plugin handles three concerns:
  • RoutingcontentConfig directs LLM traffic through the guardrails proxy.
  • IdentitybeforeModelCallback attaches the ADK session ID as an X-Agent-Session-Id header on each call.
  • Error handling — the static ADKGuardrailsPlugin.onModelError converts guardrails blocks into an LlmResponse the agent can handle gracefully.
See Usage for the contentConfig cloning caveat.

Version compatibility

Pin your provider SDK to the tested ranges to avoid breakage from private API changes: For the three LLM SDKs, wrap() resolves the installed version and throws if it falls outside the supported range.

Known limitations

  • Private attribute mutationwrap() redirects traffic by rewriting each client’s base URL and injecting the guardrails headers (X-FlintAI-API-Key, X-Guardrails-Policy-Id). For OpenAI and Anthropic this uses the internal _options.defaultHeaders, and for Google the internal apiClient.clientOptions.httpOptions. These internal attributes are not part of the providers’ public APIs and may change without notice, so pin your provider SDK versions to the tested ranges.
  • Google GenAI URL normalization — the Google GenAI SDK requires a trailing slash on the base URL. The SDK adds it automatically — do not add one to gatewayUrl.
  • Multiple provider keys in environment — if several provider API keys are set (OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_API_KEY), auto-detection fails. Pass provider explicitly to init().

Next steps

Usage

Advanced patterns, error handling, and best practices

Configuration

Environment variables, credentials, and gateway setup