Skip to content

feat: add TokenLab chat model#6605

Open
hedging8563 wants to merge 2 commits into
FlowiseAI:mainfrom
hedging8563:codex/add-tokenlab-chat-model
Open

feat: add TokenLab chat model#6605
hedging8563 wants to merge 2 commits into
FlowiseAI:mainfrom
hedging8563:codex/add-tokenlab-chat-model

Conversation

@hedging8563

Copy link
Copy Markdown

Description

Adds TokenLab as a first-class Chat Models option:

  • Adds a TokenLab API credential
  • Adds a ChatTokenLab node backed by @langchain/openai with TokenLab's OpenAI-compatible base URL https://api.tokenlab.sh/v1
  • Adds a TokenLab model catalog entry with current high-coverage models across GPT, Claude, Gemini, Grok, Qwen, DeepSeek, GLM, MiniMax, and Kimi families
  • Keeps pricing fields out of models.json because TokenLab pricing should not be inferred in this catalog without a dedicated pricing source

TokenLab also exposes native endpoint families such as Responses, Anthropic Messages, and Gemini-compatible APIs, but this Flowise node intentionally uses the existing OpenAI-compatible chat model path.

Test

  • git diff --check
  • python3 -m json.tool packages/components/models.json
  • Attempted pnpm lint -- packages/components/nodes/chatmodels/ChatTokenLab/ChatTokenLab.ts packages/components/credentials/TokenLabApi.credential.ts, but this temporary checkout cannot run the project lint because the local environment has Node v22.22.2 and pnpm 9.15.0 while the repo requires Node ^24 and pnpm ^10.26.0.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces support for TokenLab chat models by adding the TokenLabApi credential, defining TokenLab-hosted models in models.json, and implementing the ChatTokenLab chat model node. The feedback highlights two potential runtime issues: first, parsing an undefined or empty temperature value can result in NaN being passed to the model; second, parsing baseOptions as null could lead to a TypeError when checking for baseURL. Code suggestions are provided to safely handle these cases.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread packages/components/nodes/chatmodels/ChatTokenLab/ChatTokenLab.ts
Comment thread packages/components/nodes/chatmodels/ChatTokenLab/ChatTokenLab.ts
@hedging8563

Copy link
Copy Markdown
Author

Thanks for the review. I pushed 00ef1e4 to address both runtime edge cases:

  • temperature is now only assigned when the value parses to a real number, so an empty optional field no longer becomes NaN.
  • baseOptions is now validated after parsing and must be a JSON object, so null/array values produce a clear configuration error instead of a TypeError when checking baseURL.

Local validation: git diff --check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant