New Tool Radar

AI Agents & Automation

How to Set a Model Provider and API Key for a Langflow Agent

Add a provider API key in Langflow's Model Providers pane and enable the models your agent flow is allowed to use.

Schematic diagram with three steps: Open Model Providers, Add the API key, then Pick the model.

A Langflow agent cannot run until a model provider is connected. The provider key lives in one place, the Model Providers pane, and each flow then picks one of the enabled models from that provider.

Before you start

You need a Langflow account with permission to open Settings, and an API key from one model provider. Keep the key private: it is billed to your account, so never paste it into a shared flow or a public page.

Add the key in the Model Providers pane

Click your profile icon, select Settings, then click Model Providers. Select the provider, add the API key in the API Key field, and click Save. Enable the specific models you want to use in Langflow, and leave the rest off so a flow cannot pick an expensive model by accident.

Pick the model on the Agent component

Open the Agent component in your flow and select the model from the Language Model dropdown. Run one Playground question and check the reply arrives: a missing or wrong key shows up here as a model error, not as a flow error.

Worked example: Provider setup for a fictional research team

Maple Research is a fictional research desk with three agent flows. The table shows which model each flow should use and why.

Flow Model to enable Why that model
Quick answers Small fast model Short replies, low cost per call
Deep research Larger model Longer reasoning over sources
Drafting Small fast model Drafts are checked by a person

Expected result (UNTESTED): the Playground question returns a reply from the selected model, and the other two flows each use their own model. We checked the Langflow agents documentation, which describes the Model Providers pane and the Language Model dropdown, but we did not save a key on a live Langflow instance.

Limits

A provider key gives every flow that can see it the ability to spend on that provider. Limit which models are enabled, and check the provider billing page after the first week. If a key leaks, revoke it at the provider and replace it in Langflow the same day.

Sources

See all