everyapi
Integration · LLM application frameworkOpenAI-compatible · one key · live model catalog
LangChain

Run the EveryAPI gateway inside LangChain

Use EveryAPI with LangChain’s OpenAI-compatible client by setting its base URL and API key. Model and feature compatibility depends on the selected model and the request shape.

01Setup code

One base URL line points LangChain at EveryAPI

Default global Base URL / China-first Base URL: https://api.everyapi.ai/v1 / https://api-cn.everyapi.ai/v1

app.py
from langchain_openai import ChatOpenAI
 
llm = ChatOpenAI(
base_url="https://api.everyapi.ai/v1",
api_key="sk-everyapi-...",
model="claude-sonnet-5", # can also be gpt-5.5 / gemini-3.1-pro-low etc.
)
 
response = llm.invoke("Explain the PageRank algorithm in three sentences")
print(response.content)
02Steps

From zero to your first call

  1. Install langchain-openai

    pip install langchain langchain-openai or npm install @langchain/openai. EveryAPI needs no dedicated LangChain provider — just reuse the official OpenAI provider and change base_url.

  2. Generate an API key in the EveryAPI dashboard

    Sign in at app.everyapi.ai → API Keys → New Key. Copy the string that starts with sk-everyapi-.

  3. Pass two parameters when initializing ChatOpenAI

    Set base_url to https://api.everyapi.ai/v1 and api_key to your EveryAPI key. Set the model field to the real upstream model name (claude-sonnet-5 / gpt-5.5 / gemini-3.1-pro-low / MiniMax-M3 etc.).

  4. LCEL / Agent / tool calling all stay the same

    Chains, agents, tools, and streaming still use LangChain’s normal interfaces. Test each model’s tool and streaming behavior because capabilities can differ.

03FAQ

LangChain × EveryAPI

Is function / tool calling behavior consistent across upstreams?

EveryAPI translates supported protocol fields when required, but models differ in tool support and behavior. Validate your tool schema and expected responses with the exact model used in production.

Is streaming supported?

The gateway supports streaming on compatible endpoints and models. Stream event shapes and failure behavior can vary, so test the selected model with your LangChain version.