LangChain (JS) with idapt
Found this helpful? Share it:
Found this helpful? Share it:
Set up LangChain (JS) against idapt's compatible APIs with the steps below. This article and the AI Gateway quickstarts lander render the same shared steps, so they never drift.
LangChain (JS) with idapt
ChatOpenAI against idapt's compatible API: one configuration block, 200+ models.
npm i @langchain/openaiimport { ChatOpenAI } from "@langchain/openai";
const model = new ChatOpenAI({
model: "openai/gpt-6-astra",
apiKey: process.env.IDAPT_API_KEY,
configuration: { baseURL: "https://idapt.app/api/openai/v1" },
});const withTools = model.bindTools([myTool]);
const reply = await withTools.invoke("What is 23 * 17? Use the calculator.");Tool calling passes through for every tool-capable catalog model.
Related articles
API keys and scopes
Create a key, choose its scopes, pin it to an API version, rotate it, and cap what it can spend.
Rate limits and errors
Every error shape the API returns, what each rate limit is, and how to handle a wall in code.
Cap what an API key spends
Give every Gateway API key a lifetime, monthly, or daily USD cap, and what a capped-out key returns.
OpenAI-compatible API
Use idapt's 200+ models from any app that speaks the OpenAI API format.
LangChain (Python) with idapt
Use LangChain Python with idapt's OpenAI-compatible API: base_url configuration for ChatOpenAI with any catalog model.
Vercel AI SDK with idapt
Use the Vercel AI SDK with idapt's OpenAI-compatible API: provider setup, streaming, and tool calls with one base-URL swap.
LlamaIndex with idapt
Use LlamaIndex with idapt: configure the OpenAI-like client with a custom base URL and run retrieval pipelines on any catalog model.
Was this helpful?