Connect Langflow to an OpenAI-compatible endpoint, on any version.

Updated 2026-07-16

Langflow's 1.11 release line adds OpenAI Compatible as a first-class model provider: one base URL, one key, live model discovery. Installations on earlier versions still have two working paths, the vLLM component and the OPENAI_API_BASE environment variable. This page covers all three honestly.

Quick answer: your Langflow version decides the path.

On the 1.11 release line, Langflow has a native answer: Settings, Model Providers, OpenAI Compatible. Enter the base URL (https://api.apisrouter.com/v1 for APIsRouter) and the key, and Langflow discovers the served models live from the endpoint's /v1/models route, listing them in the model pickers across your flows, the Agent component included. On earlier versions there is no generic provider slot; the unified providers were OpenAI, Google, IBM watsonx, and Ollama only. The two paths that work there are the vLLM bundle component, which despite the name is a generic OpenAI-compatible client with its own api_base, api_key, and model_name fields, and the OPENAI_API_BASE environment variable, which repoints the langchain-based OpenAI components wholesale. Both are covered below with their sharp edges, because each has one.

Base URL:  https://api.apisrouter.com/v1
API Key:   sk-APIsRouter-...

models are discovered live from /v1/models
and appear in flow model pickers

What changed, and why older guides disagree.

Langflow (langflow-ai on GitHub, roughly 152K stars) is the most visible visual builder for agent and RAG flows, and for most of its life a generic OpenAI-compatible endpoint was a persistent gap. Users asked for a custom base URL as far back as 2024, a dedicated feature request for an OpenAI Compatible provider option was opened in April 2026, and community answers accumulated workarounds: edit the component code, use the LiteLLM bundle, misuse a local-model component. That request closed because the feature shipped. The implementing pull request, titled "add OpenAI Compatible as a first-class unified model provider," merged into the release-1.11.0 line on July 1, 2026. It registers the provider in Settings, takes a required base URL and an optional key, validates credentials with real error messages, discovers models live from the endpoint, and reuses the existing ChatOpenAI and OpenAIEmbeddings classes underneath rather than introducing a new client. The practical consequence: guides written before mid-2026 describe a Langflow that no longer matches current releases, and guides written after assume a version many self-hosted installations have not reached. Check your version first; everything else on this page follows from it.

The native path on 1.11: configure once, reuse everywhere.

Open Settings, go to Model Providers, and choose OpenAI Compatible. The provider takes two values, a required base URL and an optional API key, and runs a live check against the endpoint when you save: a wrong URL, a failed authentication, or an unreachable host each produce a distinct error rather than a silent failure. Once saved, the models the endpoint serves appear in the model pickers, so a flow's Language Model or Agent component selects claude-sonnet-4-6 or deepseek-v4-pro the same way it would select a first-party id. This is the configure-once shape the feature request asked for: the endpoint is defined at workspace level and every flow reuses it, instead of each component carrying its own copy of the URL and key. Model discovery also means new catalog ids appear without touching Langflow at all. If Settings has no OpenAI Compatible entry, your installation predates the feature. Upgrading is the clean fix; where that is not an option this week, the next section is the honest state of the workarounds, both of which keep working on current versions too.

curl -s https://api.apisrouter.com/v1/models \
  -H "Authorization: Bearer $APISROUTER_API_KEY" | head -50

The older-version paths, with their sharp edges.

The vLLM component is the per-flow path. It lives in the vLLM bundle but is a generic OpenAI-compatible client built on ChatOpenAI: api_base takes the endpoint URL including /v1 (its documented default is http://localhost:8000/v1, note the suffix), api_key takes the gateway key, and model_name takes any served id as a plain string. Its Language Model output plugs into Agent and other LLM-driven components, which is how you put a Claude id behind an agent on a pre-1.11 Langflow. The sharp edge is repetition: the URL and key are per component instance, so a workspace with many flows carries many copies, and rotating a key means editing each one. OPENAI_API_BASE is the global path. The langchain-openai classes underneath Langflow's OpenAI components honor it when no explicit base is set, so exporting it before starting Langflow repoints those components at the gateway with zero UI changes. The sharp edge is scope: it moves every OpenAI-flavored component in the process, embeddings included, and an OpenAI Embeddings component quietly pointed at an endpoint that does not serve its embedding id fails in retrieval paths far from where you made the change. Use it when the whole instance should route through the gateway, not for one flow. Also worth knowing: some component parameters are hidden by default in the visual editor and only appear in the component inspection panel, which is where several of the fields named here live.

api_base:   https://api.apisrouter.com/v1   (keep the /v1)
api_key:    sk-APIsRouter-...
model_name: claude-sonnet-4-6

output: Language Model -> connect to Agent component

Pay-as-you-go · transparent per-model pricing

Selected models are priced below official list prices. Exact input, output, cache, and per-request prices are shown for each model.

ModelOfficial PriceOur Price
Claude Sonnet 4.6$3.00 / $15.00 per M$2.40 / $12.00 per M
GPT-5.5$5.00 / $30.00 per M$4.00 / $24.00 per M
Claude Haiku 4.5 20251001$1.00 / $5.00 per M$0.80 / $4.00 per M
DeepSeek V4 Flash$0.14 / $0.28 per M$0.13 / $0.25 per M
Gemini 3.1 Pro Preview$2.00 / $12.00 per M$1.60 / $9.60 per M

Choosing models for flows and agents.

Every candidate bills through the same key, and the per-model usage in the APIsRouter console prices each experiment as you run it, which suits Langflow's iterate-in-the-canvas workflow well.

  • Agent components do tool-calling loops, and loop quality is model quality. claude-sonnet-4-6 and gpt-5.5 hold multi-step plans together; weaker ids lose the thread in ways that look like flow bugs.
  • High-volume flow steps, classification, extraction, and routing nodes, belong on fast ids. claude-haiku-4-5-20251001 and deepseek-v4-flash keep a busy flow from concentrating spend on plumbing.
  • Long-context steps that ingest whole documents are where gemini-3.1-pro-preview earns a test in your pipeline.
  • A flow is a chain, so one slow model gates the whole run. Latency per node matters more in Langflow than in a chat client, which argues for fast ids everywhere the output is machine-read.
  • With provider-level discovery on 1.11, comparing two models is changing one picker value and rerunning the flow, so measure on your own flows rather than trusting general benchmarks.

Failure modes specific to Langflow.

The version mismatch is the big one. Following a 1.11-era guide on a 1.10 installation ends at a Settings page with no OpenAI Compatible entry, and following a 2025-era guide on a current version buries you in workarounds the release made unnecessary. Establish the version before the tutorial. The /v1 conventions differ by surface. The vLLM component's api_base expects the suffix included, as its localhost default shows. The 1.11 provider normalizes URLs, but entering the bare host with no path on older component-level fields produces 404s when the client appends /chat/completions. The env variable moves more than you meant. OPENAI_API_BASE repoints embeddings components along with chat models, and a retrieval flow whose embedder can no longer resolve its model fails at search time, not at configuration time. If retrieval broke right after an env change, that is why. And on pre-1.11 versions, per-component config drifts. Two flows configured on different days can point at different endpoints or carry stale keys, and the symptom is one flow working while its sibling fails. The provider-level config in 1.11 exists precisely because this class of drift was common.

Who routes Langflow through a gateway.

  • Flow builders who want Claude, GPT, Gemini, and DeepSeek selectable in the same canvas without one provider account per vendor.
  • Teams standardizing on 1.11 provider-level config: one base URL and one key at workspace level, rotated in one place, used by every flow.
  • Self-hosters on older versions using the vLLM component to put frontier ids behind Agent components today, before their upgrade window.
  • Builders comparing models per flow step, where each candidate is a picker change and the usage log prices the comparison.
  • Developers without access to a given vendor's billing. Top-up based access with no card requirement removes the per-provider sign-up dependency.

Verify the endpoint and debug the first flow run.

Prove the gateway half first: the curl above should list every id you plan to select. On 1.11, the provider's own validation then covers most of the rest, since it distinguishes a bad URL from a bad key from an unreachable host at save time. On older versions, debug per surface. A component erroring with model-not-found is an id typo in model_name against the /v1/models listing. A 404 on every request is a missing /v1 in api_base. A 401 means the key field on that specific component is wrong or empty, and because config is per component, check the component that failed rather than the one you configured yesterday. If a retrieval flow broke after an environment change, unset OPENAI_API_BASE and scope the endpoint back into components. Once flows run, the APIsRouter console shows per-request model, token counts, and spend. Visual builders make it easy to forget that every node is a billed API call; the usage log is where a flow's real per-run cost becomes a number you can read.

curl -s https://api.apisrouter.com/v1/chat/completions \
  -H "Authorization: Bearer $APISROUTER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"claude-sonnet-4-6",
       "messages":[{"role":"user","content":"ping"}]}'

FAQ

Does Langflow support a custom OpenAI-compatible base URL natively?

On the 1.11 release line, yes: Settings, Model Providers, OpenAI Compatible, with a required base URL and optional key, plus live model discovery from /v1/models. The implementing pull request merged into release-1.11.0 in July 2026. Earlier versions have no generic provider slot and need the vLLM component or the OPENAI_API_BASE environment variable.

How do I use Claude or DeepSeek in Langflow before 1.11?

Use the vLLM bundle component, which is a generic OpenAI-compatible client despite the name. Set api_base to https://api.apisrouter.com/v1, api_key to your gateway key, and model_name to the served id. Its Language Model output connects to Agent and other LLM-driven components.

Does OPENAI_API_BASE work with Langflow?

Yes, because Langflow's OpenAI components are built on langchain-openai, which honors the variable when no explicit base is set. But it moves every OpenAI-flavored component in the process, embeddings included, so retrieval flows can break if the endpoint does not serve their embedding id. Prefer component or provider level config unless you mean to move everything.

Should the base URL include /v1?

For the vLLM component, yes; its documented default is http://localhost:8000/v1 with the suffix included, and APIsRouter's value is https://api.apisrouter.com/v1. The 1.11 provider normalizes what you enter, but including the /v1 is the safe habit on every Langflow surface.

Why does my Settings page have no OpenAI Compatible provider?

Your installation predates the 1.11 release line, where the provider landed. Upgrade to get workspace-level config and model discovery, or use the vLLM component path in the meantime, which works on both old and current versions.

Can Langflow's Agent component use models through this endpoint?

Yes. On 1.11 the discovered models appear in the Agent component's pickers directly. On older versions, connect the vLLM component's Language Model output into the Agent component and the agent loop runs on whatever id you set in model_name.