Skip to content

feat(providers): add ClinePass provider (API key) - #2304

Closed
adentdk wants to merge 3 commits into
decolua:masterfrom
adentdk:feat-clinepass-provider
Closed

adentdk wants to merge 3 commits into
decolua:masterfrom
adentdk:feat-clinepass-provider

Conversation

@adentdk

@adentdk adentdk commented Jul 2, 2026 •

Copy link
Copy Markdown

Summary

Add end-to-end support for ClinePass, Cline's flat $9.99/month subscription that proxies through Cline's OpenAI-compatible Chat Completions endpoint. Authentication is by API key from Settings > API Keys in app.cline.bot (per the docs) — the OAuth flow with client_type=extension is the IDE extension flow and is unrelated.

Brings the ClinePass model catalog (cline-pass/..., 10 models) into the existing /v1/models flow with proper thinking handling.

Closes #2252 (no separate OAuth flow needed — API key was the intended path)

What's in

  • open-sse/providers/registry/clinepass.js — provider registry entry; category: "apikey"
  • open-sse/providers/capabilities.js — capability hints for deepseek-v4-pro / deepseek-v4-flash
  • open-sse/services/clinepassModels.js — /v1/models live resolver (works with API key)
  • open-sse/utils/clinepassEnvelope.js — unwraps ClinePass's {success,data} response envelope and the error path
  • open-sse/executors/default.js — max_tokens floor (4096) for reasoning-enabled models to avoid empty-content length finishes
  • open-sse/translator/concerns/thinkingUnified.js — map internal max → xhigh, drop unknown levels (Vercel/OpenAI only accept {none,minimal,low,medium,high,xhigh})
  • open-sse/handlers/chatCore.js + nonStreamingHandler.js — envelope unwrap + one retry on transient empty response content
  • open-sse/utils/error.js — error path uses envelope unwrap
  • src/lib/oauth/providers.js — clinepass registered as flowType: "apikey"
  • src/app/api/v1/models/route.js — live resolver wiring

Why an API key, not OAuth

Issue #2252 hit a 401 on client_type=extension OAuth — that flow is for the Cline IDE extension and produces a token the API rejects. ClinePass itself authenticates with a regular API key from app.cline.bot/settings/api-keys.

How to try it

  1. Subscribe to ClinePass at https://app.cline.bot.
  2. Create an API key at https://app.cline.bot/settings/api-keys.
  3. In 9Router → Providers → ClinePass → paste the API key.
  4. Add a model with ID clinepass/deepseek-v4-flash (or -pro, or any of the 10 listed in the registry).
  5. Test — should succeed without the 401.

Tested locally

  • /v1/models returns the 10 ClinePass models.
  • deepseek-v4-pro reasoning responses return non-empty content within budget.

Branch: feat-clinepass-provider on https://github.com/adentdk/9router

Ports ClinePass (Vercel-proxied OpenAI Chat Completions) end-to-end:
- registry entry + capability hints for deepseek-v4-pro/flash
- envelope unwrap for {success,data} responses and error path
- thinking budget floor (4096) to avoid empty content on long reasoning
- retry once on transient "empty response content"
- OAuth flow (authorization_code, no PKCE) reusing Cline's auth URL
- Vercel-friendly reasoning.effort mapping (max -> xhigh, drop unknown)
- /v1/models live resolver for ClinePass catalog

Co-Authored-By: Claude <noreply@anthropic.com>
ClinePass is a flat \$9.99/month subscription authenticated by an API
key from Settings > API Keys in app.cline.bot (per
https://docs.cline.bot/getting-started/clinepass). The previous
authorization_code flow was misclassified — the OAuth callback
(client_type=extension) is the IDE extension flow and produces a
401 on the API, which is what issue decolua#2252 hit.

Changes:

- registry/clinepass.js: category "oauth" -> "apikey", drop
  authModes/hasOAuth/oauth block/clinepassHeaders hook, point
  display.notice at the API keys page
- executors/default.js: drop the now-dead clinepass refresh grant
  and the clinepassHeaders hook (default bearer is correct for
  an API key)
- oauth/providers.js: replace the full clinepass OAuth block with
  a one-liner flowType: "apikey" entry
- oauth/constants/oauth.js: drop CLINEPASS_CONFIG and the
  CLINEPASS enum value
- oauth/[provider]/[action]/route.js: remove clinepass from
  noPkceExchangeProviders

Closes decolua#2253 (no separate OAuth flow needed)

Co-Authored-By: Claude <noreply@anthropic.com>
@adentdk adentdk changed the title feat(providers): add ClinePass provider support feat(providers): add ClinePass provider (API key) Jul 2, 2026
Strip cline-pass/ prefix from exposed model IDs and add upstreamModelId
so the upstream API still receives the full prefixed ID. Model alias now
reads clinepass/deepseek-v4-pro instead of clinepass/cline-pass/deepseek-v4-pro.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@adentdk

adentdk commented Jul 2, 2026 •

Copy link
Copy Markdown
Author

Update: shortened model aliases (8fe0652)

The model alias was unnecessarily long: clinepass/cline-pass/deepseek-v4-pro — because the upstream API's cline-pass/ prefix was concatenated with the clinepass/ provider alias without stripping.

Changes:

  • Registry model IDs no longer include the prefix: deepseek-v4-pro (was cline-pass/deepseek-v4-pro)
  • upstreamModelId added so the upstream Cline API still receives the full prefixed ID
  • Live resolver (clinepassModels.js) now strips the prefix from API-returned models

Result: "model": "clinepass/deepseek-v4-pro" — clean, two-segment alias.

@ohahe52-dot

Copy link
Copy Markdown

Thanks for taking the time to review my issue and for submitting a pull request to address it.

I understand that it uses an API key for authentication and usage. Initially, I tried using the OpenAI-compatible API, but it returned a 404 error. It seems that Cline is blocking it.

Hopefully your pull request will be merged into 9router soon, so I can use Cline Pass more smoothly without these authentication issues.
image

@decolua

decolua commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Thanks @adentdk for the contribution! Reviewed and accepted — applying it to master. 🙏

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.

Cline OAuth connection fails with 401 "re-authenticate" error despite active Cline Pass subscription

3 participants