Skip to content

feat: add LongCat provider with LongCat-2.0 model#2967

Merged
rekram1-node merged 10 commits into
anomalyco:devfrom
mookechee:feat/add-longcat-provider
Jul 4, 2026
Merged

feat: add LongCat provider with LongCat-2.0 model#2967
rekram1-node merged 10 commits into
anomalyco:devfrom
mookechee:feat/add-longcat-provider

Conversation

@mookechee

@mookechee mookechee commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds the LongCat provider (Meituan) with the LongCat-2.0 model.

  • providers/longcat/provider.toml — OpenAI-compatible provider (@ai-sdk/openai-compatible, api https://api.longcat.chat/openai)
  • providers/longcat/models/LongCat-2.0.toml — provider-specific fields (cost, reasoning options, interleaved), inheriting shared model facts from models/meituan/longcat-2.0.toml via base_model
  • providers/longcat/logo.svg — official cat icon, monochrome currentColor, centered

Model facts (sourced from official docs)

Field Value Source
context 1,000,000 docs (1M context)
output 131,072 docs (max output 128K)
cost input / output / cache_read 0.75 / 2.95 / 0.015 USD per 1M official USD pricing page (standard rate)
reasoning toggle (thinking: enabled/disabled) chat API docs
interleaved reasoning_content chat API docs
tool_call true changelog ("native tool calling")
modalities text-only docs ("text input only")
release_date 2026-06-30 changelog

Self-test

  • Schema: bun validate → exit 0, provider generates correctly.
  • Model id case: GET /v1/models returns exactly LongCat-2.0; a lowercase id is rejected with 400 Unsupported model — hence the exact-case filename (same convention as MiniMax-M2.toml).
  • opencode end-to-end: loaded this branch's generated api.json into 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-sensitiveGET https://api.longcat.chat/openai/v1/models returns exactly one id:

"LongCat-2.0"

Request with the lowercase id (as recorded by opencode):

HTTP 400 — https://api.longcat.chat/openai/chat/completions
{"error":{"code":"invalid_parameter","message":"Unsupported model (model=longcat-2.0)","type":"invalid_request_error"}}

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 via OPENCODE_MODELS_PATH; cache_read pricing was not exercised (no cache hit); both …/openai and …/openai/v1 base URLs respond 200 — the documented form (…/openai) is used.

Official sources

@nathannli

nathannli commented Jul 1, 2026

Copy link
Copy Markdown

i think you should use base model syntax since longcat/meituan is the lab for this model

@mookechee

Copy link
Copy Markdown
Contributor Author

Good call, thanks! Refactored to use base_model syntax: moved the provider-agnostic facts into models/meituan/longcat-2.0.toml (meituan being the lab) and providers/longcat/models/longcat-2.0.toml now inherits via base_model = "meituan/longcat-2.0", keeping only the provider-specific fields (cost, reasoning_options, interleaved). bun validate passes and the resolved output is identical. This also aligns with how meituan's other longcat models are namespaced.

@mookechee mookechee force-pushed the feat/add-longcat-provider branch from b63744f to c57771e Compare July 2, 2026 04:39
@nathannli nathannli mentioned this pull request Jul 4, 2026
@rekram1-node rekram1-node merged commit 496f79b into anomalyco:dev Jul 4, 2026
1 check passed
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.

3 participants