> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://www.respan.ai/docs/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://www.respan.ai/docs/_mcp/server.

# Langflow (gateway)

> Set up Langflow with the Respan gateway.

Langflow is Python-only. Route its underlying LLM calls through the Respan gateway to use 1000+ models from different providers. Only your Respan API key is needed — no separate provider keys required.

## Setup

#### Install Langflow

```bash
pip install langflow
```

#### Point Langflow at the gateway

Set the API key environment variable before starting Langflow. Its OpenAI component reads `OPENAI_API_KEY` by default:

```bash
export OPENAI_API_KEY="YOUR_RESPAN_API_KEY"
```

No real OpenAI key needed. The Respan gateway handles provider authentication. Keep the component's API key field at its default (`OPENAI_API_KEY`).

The component does not read `OPENAI_BASE_URL`. Set the base URL on the component itself in the next step.

#### Start Langflow and build your flow

```bash
langflow run
```

Open the UI and add an OpenAI component to your flow. Expand its advanced settings and set **OpenAI API Base** to `https://api.respan.ai/api`. Every run of that component is now routed and logged through Respan.

## Run an exported flow programmatically (optional)

`run_flow_from_json` runs a flow you have already exported from the Langflow UI (**Share → Export**). Export the flow to a `.json` file first, then:

```python
from langflow.load import run_flow_from_json

result = run_flow_from_json(
    flow="path/to/your/flow.json",  # exported from the Langflow UI
    input_value="What is the meaning of life?",
)
print(result)
```

The exported flow keeps the **OpenAI API Base** value you set on each OpenAI component, so calls still route through Respan.

## Switch models

Change the model in your flow's OpenAI component to another model available through the gateway, for example `gpt-5.5` or `gpt-5-mini`.

See the [full model list](https://platform.respan.ai/platform/models).