feat: add LongCat provider with LongCat-2.0 model#2967
Merged
Conversation
6 tasks
|
i think you should use base model syntax since longcat/meituan is the lab for this model |
Contributor
Author
|
Good call, thanks! Refactored to use |
b63744f to
c57771e
Compare
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the LongCat provider (Meituan) with the LongCat-2.0 model.
providers/longcat/provider.toml— OpenAI-compatible provider (@ai-sdk/openai-compatible, apihttps://api.longcat.chat/openai)providers/longcat/models/LongCat-2.0.toml— provider-specific fields (cost, reasoning options, interleaved), inheriting shared model facts frommodels/meituan/longcat-2.0.tomlviabase_modelproviders/longcat/logo.svg— official cat icon, monochromecurrentColor, centeredModel facts (sourced from official docs)
thinking: enabled/disabled)reasoning_contentSelf-test
bun validate→ exit 0, provider generates correctly.GET /v1/modelsreturns exactlyLongCat-2.0; a lowercase id is rejected with 400Unsupported model— hence the exact-case filename (same convention asMiniMax-M2.toml).api.jsoninto opencode (v1.16.2); live completion succeeded and the computed cost matched the listed prices exactly (reasoning billed at the output rate).Evidence (raw API responses & cost records)
Model id is case-sensitive —
GET https://api.longcat.chat/openai/v1/modelsreturns exactly one id:"LongCat-2.0"Request with the lowercase id (as recorded by opencode):
Cost accounting — successful run after the rename (only change), recorded by opencode:
{"modelID": "LongCat-2.0", "cost": 0.00786295, "tokens": {"input": 10421, "output": 4, "reasoning": 12, "cache": {"read": 0, "write": 0}}}Hand check against this PR's prices:
(10421 × $0.75 + (4 + 12) × $2.95) / 1e6 = $0.00786295— exact match.Notes: the catalog was generated from this branch with this repo's
generateCatalog()and loaded viaOPENCODE_MODELS_PATH;cache_readpricing was not exercised (no cache hit); both…/openaiand…/openai/v1base URLs respond 200 — the documented form (…/openai) is used.Official sources
thinkingtoggle andreasoning_content: https://longcat.chat/platform/docs/api/chat.html