Langflow

Langflow

Low-code visual builder for LangChain-based AI workflows and pipelines

Introduction

Langflow is a visual, low-code builder for LangChain pipelines. Its OpenAI component accepts a custom OpenAI API Base URL, so you can redirect all model calls to TokenMix and use Claude, GPT-5, DeepSeek, or any other TokenMix model without modifying your pipeline logic.

Prerequisites

Self-host Langflow with Docker:

docker run -p 7860:7860 langflowai/langflow:latest

Access Langflow at http://localhost:7860.

For persistent storage, add a volume:

docker run -p 7860:7860 \
  -v langflow_data:/app/langflow \
  langflowai/langflow:latest

You also need a TokenMix API key. Sign up at tokenmix.ai → Console → API Keys and create a new key.

Setup Steps

Step 1 — Open your flow

In Langflow, open an existing flow or create a new one via New Flow.

Step 2 — Add or select an OpenAI component

Drag an OpenAI (or OpenAI Embeddings) component onto the canvas, or click on an existing one.

Step 3 — Set the API base and key

In the component's settings panel on the right:

Field Value
OpenAI API Key Your TokenMix key (sk-tm-…)
OpenAI API Base https://api.tokenmix.ai/v1
Model Name e.g. gpt-5.4 or claude-sonnet-4.6

Click Check & Save or close the panel — Langflow saves automatically.

Alternative: environment variable approach (most reliable)

If you want all OpenAI components in the instance to use TokenMix by default, set the environment variable before starting the container:

docker run -p 7860:7860 \
  -e OPENAI_API_BASE=https://api.tokenmix.ai/v1 \
  -e OPENAI_API_KEY=sk-tm-your-key \
  langflowai/langflow:latest

With this approach, the OpenAI API Base field is pre-filled and you only need to enter a model name.

Step 4 — Add Embedding support (for RAG flows)

Drag an OpenAI Embeddings component onto the canvas. Set the same OpenAI API Base and API key, then set Model Name to an embedding model available on TokenMix (e.g. text-embedding-3-large). Connect it to your vector store component.

Verify

Run your flow using the Run or Playground button. A successful output in the result panel confirms TokenMix is handling the request.

Check Console → Usage on TokenMix to see the request logged.

FAQ

Q: All components show an error after I set the API Base — what's wrong? A: Make sure the URL ends with /v1 (no trailing slash). Also ensure the API key starts with sk-tm- and has no extra whitespace.

Q: Which embedding models can I use? A: Visit tokenmix.ai → Models and filter by Embedding type. Copy the short_id (e.g. text-embedding-3-large) into the OpenAI Embeddings component's Model Name field.

Q: Can I use different models in different components of the same flow? A: Yes. Each OpenAI component has its own Model Name field. Set them independently while sharing the same API Base and key.