Documentation

SDK Tutorials

Point any LLM client at the AI Firewall. Two settings change — base_url and api_key — and nothing else about your code does.

Every client on this page is configured the same way. You change two settings:

  • base_url — point it at the gateway instead of the provider.
  • api_key — send your Vulnetix API key (VULNETIX_API_KEY), not a provider key. The provider key stays in the BYOK vault, where the gateway decrypts it just-in-time and injects it on the way upstream.

Nothing else changes. Your model strings, your messages, your tools, your streaming loop, your response parsing — all identical. The gateway speaks the same wire protocol your SDK already speaks, so the SDK cannot tell the difference. The one genuinely new thing you should add is a catch for a 403, which is how a guardrail refusal arrives. Every page below has a section on it.

The two base-URL shapes

Warning Anthropic SDKs take a base URL with no /v1. They append /v1 themselves. Every other client expects /v1 in the base URL. This is the single most common misconfiguration.
Your clientBase URL
OpenAI SDKs, LangChain, LlamaIndex, curl, everything elsehttps://guardrails.vulnetix.com/{providerSlug}/{orgUuid}/v1
Anthropic SDKshttps://guardrails.vulnetix.com/anthropic/{orgUuid}no /v1

{orgUuid} is your organisation UUID, from the dashboard. {providerSlug} is one of openai, anthropic, openrouter, groq, mistral, deepseek, xai, together, fireworks, alibaba, moonshot, minimax.

Model names pass through verbatim. gpt-4o-mini on openai, openai/gpt-4o-mini on openrouter, claude-sonnet-5 on anthropic — use whatever the provider itself calls the model.

The CLI writes the code for you

Rather than copying a base URL by hand, have the CLI print a working snippet with your organisation UUID and provider already substituted in:

vulnetix ai-firewall snippet --lang python --sdk openai --provider openai

Templates exist for these pairs, and only these:

--lang--sdk
pythonopenai, anthropic, langchain, llamaindex
tsopenai, anthropic, vercel-ai
goopenai
shcurl

For every other language on this page, the pattern is the same — copy it from the page.

Note Why the base URL usually has to be set in code. Most providers have no base-URL environment variable that any SDK reads, and the Vercel AI SDK ignores OPENAI_BASE_URL entirely. For those clients, setting base_url in code is not a convenience — it is the only mechanism that routes traffic through the firewall.

Pick your client

Frameworks

Anthropic-wire clients

What each provider serves

ProviderSurfaces
openaiChat Completions, Responses
anthropicMessages
everything elseChat Completions

Pointing a client at a surface a provider does not serve returns 404 with code unsupported_api, and the message tells you which base URL to use instead. See base URLs & request surfaces.

Python
Route the official OpenAI Python SDK through the AI Firewall by changing base_url and api_key. Nothing else about your code changes.
Node.js & TypeScript
Route the official OpenAI Node SDK through the AI Firewall by changing baseURL and apiKey. Nothing else about your code changes.
curl & raw HTTP
The wire format, exactly. Two headers and a URL — everything an SDK does for you, written out.
Go
Route the official openai-go SDK through the AI Firewall with two request options — WithBaseURL and WithAPIKey.
Java
Route the official openai-java SDK through the AI Firewall by setting baseUrl and apiKey on the client builder.
.NET / C#
Route the official OpenAI .NET SDK through the AI Firewall with OpenAIClientOptions.Endpoint and an ApiKeyCredential.
Ruby
Route the official openai Ruby gem through the AI Firewall by setting base_url and api_key on the client.
PHP
Route openai-php/client through the AI Firewall with withBaseUri and withApiKey. Two factory calls, no other change.
Rust
Route async-openai through the AI Firewall with OpenAIConfig::with_api_base and with_api_key.
Kotlin
Route Kotlin LLM calls through the AI Firewall — with the official openai-java SDK, or the community openai-kotlin client.
Swift
Route Swift LLM calls through the AI Firewall — with the community MacPaw OpenAI package, or with plain URLSession.
Dart & Flutter
Route openai_dart through the AI Firewall by setting baseUrl and the API key. Flutter apps should call the gateway from a backend, not the device.
Elixir
Route openai_ex through the AI Firewall with OpenaiEx.with_base_url. Two settings, no other change.
LangChain
Route LangChain through the AI Firewall by giving ChatOpenAI a base_url and your Vulnetix key. Chains, agents, and tools are unaffected.
LlamaIndex
Route LlamaIndex through the AI Firewall by giving its OpenAI LLM an api_base and your Vulnetix key. Indexes, retrievers, and query engines are unaffected.
Vercel AI SDK
The Vercel AI SDK ignores OPENAI_BASE_URL, so setting baseURL in code is not a convenience — it is the only thing that routes traffic through the firewall.
Pydantic AI
Route Pydantic AI agents through the AI Firewall with an OpenAIProvider that has a base_url and your Vulnetix key.
Spring AI
Route Spring AI through the AI Firewall with two properties — spring.ai.openai.base-url and spring.ai.openai.api-key. No Java changes.
Anthropic (Python)
Route the Anthropic Python SDK through the AI Firewall. The base URL has no /v1 — the SDK appends it itself.
Anthropic (TypeScript)
Route the Anthropic TypeScript SDK through the AI Firewall. The base URL has no /v1 — the SDK appends it itself.