Frameworks
Using AI Setu with agent frameworks and orchestration libraries.
AI Setu doesn't ship a dedicated plugin for any particular framework —
because it's a drop-in OpenAI-compatible endpoint
(https://gateway.aisetu.ai/v1), any framework that lets you point its
OpenAI client at a custom base URL and key works without one. This page
shows the standard override for a few common frameworks. These aren't
officially maintained integrations, and the exact configuration option
names are each framework's own — check their docs if something below is
out of date.
Whatever framework you use, the request still goes through AI Setu's normal routing, caching, and guardrails — nothing about going through a framework changes gateway behavior.
The general pattern
Every framework below reduces to the same two settings: swap the base URL
to https://gateway.aisetu.ai/v1, and pass your AI Setu key instead of a
raw OpenAI key. Where the framework asks for a model name, use any of the
three model forms AI Setu
accepts.
LangChain / LangChain.js
ChatOpenAI (and the Python langchain-openai equivalent) accepts a base
URL override:
import { ChatOpenAI } from '@langchain/openai';
const model = new ChatOpenAI({
apiKey: process.env.AI_SETU_API_KEY,
model: 'openai/gpt-4o-mini',
configuration: { baseURL: 'https://gateway.aisetu.ai/v1' },
});from langchain_openai import ChatOpenAI
model = ChatOpenAI(
api_key=os.environ["AI_SETU_API_KEY"],
model="openai/gpt-4o-mini",
base_url="https://gateway.aisetu.ai/v1",
)Vercel AI SDK
Use the OpenAI-compatible provider factory and point it at the gateway:
import { createOpenAICompatible } from '@ai-sdk/openai-compatible';
import { generateText } from 'ai';
const aiSetu = createOpenAICompatible({
name: 'ai-setu',
apiKey: process.env.AI_SETU_API_KEY,
baseURL: 'https://gateway.aisetu.ai/v1',
});
const { text } = await generateText({
model: aiSetu('openai/gpt-4o-mini'),
prompt: 'Hello!',
});LlamaIndex
The OpenAI LLM class takes the same override:
import { OpenAI } from 'llamaindex';
const llm = new OpenAI({
apiKey: process.env.AI_SETU_API_KEY,
model: 'openai/gpt-4o-mini',
additionalSessionOptions: { baseURL: 'https://gateway.aisetu.ai/v1' },
});Things to check when adapting a framework
- Streaming — AI Setu's
stream: trueresponses are OpenAI-shaped SSE; frameworks that consume the OpenAI SDK's stream iterator work unchanged. - Tool calling — forwarded verbatim to whichever provider serves the request; not every upstream model supports every tool-calling shape a framework might send. Bedrock text-only models, for example, reject tool calls with a clear error.
- Embeddings — only the OpenAI and Gemini providers implement
/v1/embeddingstoday (see Models); a framework's embedding step needs a model routed to one of those. - Headers — AI Setu's routing, caching, and BYOK headers (documented throughout these Concepts pages) are plain HTTP headers. If your framework exposes a way to attach custom headers to the underlying OpenAI client, you can still use them alongside a framework integration.