TokenLab

Frameworks & Platforms

Prompt flow

Use TokenLab through Prompt flow OpenAI connections

Overview

Prompt flow's OpenAI connection supports a custom base_url. Set it to TokenLab's /v1 endpoint and use TokenLab model IDs in your flow.

Installation

pip install promptflow promptflow-tools

Create A Connection

Save the connection below as openai.yaml. The command prompts for the API key locally. In an OpenAI flow node, put the TokenLab model ID in inputs.model; deployment_name is for Azure OpenAI.

$schema: https://azuremlschemas.azureedge.net/promptflow/latest/OpenAIConnection.schema.json
name: open_ai_connection
type: open_ai
base_url: https://api.tokenlab.sh/v1
api_key: "<user-input>"
pf connection create --file openai.yaml

Flow Notes

In your flow.dag.yaml, keep the connection name aligned with the command above:

nodes:
  - name: chat
    type: llm
    source:
      type: code
      path: chat.jinja2
    inputs:
      model: claude-sonnet-5
    api: chat
    connection: open_ai_connection

Endpoint Notes

This integration uses Prompt flow's OpenAI-compatible connection. Native TokenLab Responses, Anthropic Messages, and Gemini routes require Prompt flow tools or custom Python nodes that call those endpoints directly.

On this page