Cline + any OpenAI-compatible gateway: Base URL ends at /v1

●3 ●5
calendar_today • schedule1 min read

Cline (the independent VS Code / JetBrains coding agent — not affiliated with this post) has a first-party “OpenAI” provider and a separate OpenAI Compatible provider. For a custom gateway you want the second one.

1. Smoke-test outside the IDE

export LLM_API_KEY='…'
export LLM_BASE_URL='https://api.china-aiapi.com/v1'

curl -sS "$LLM_BASE_URL/models" -H "Authorization: Bearer $LLM_API_KEY" | head

Pick a MODEL_ID that appears in that list.

2. Cline settings

  • API Provider → OpenAI Compatible
  • Base URL → https://api.china-aiapi.com/v1 (stop at /v1; do not append /chat/completions)
  • API Key → value of $LLM_API_KEY (no Bearer prefix)
  • Model → MODEL_ID
  • Open Model Configuration and set context window / max tokens yourself; custom providers do not infer them

3. Optional CLI shape (if your Cline build ships cline auth):

cline auth -p openai -k "$LLM_API_KEY" -b "$LLM_BASE_URL" -m "MODEL_ID"

Troubleshooting

Symptom → Likely cause
404 on chat → Base URL missing /v1 or has an extra /v1/v1
401 → Key not exported / pasted with trailing space
Model not found → MODEL_ID ≠ an id from /models
Tiny context / early cuts → Model Configuration left at defaults

Happy to compare notes if anyone is wiring Cline through a corporate OpenAI-compatible proxy instead of a hosted gateway.


Disclosure: I work on the APIGOTO team; independent of OpenAI, Anthropic and Google. Cline is an independent product. Example gateway used above is ours (pay-as-you-go, logs only if enabled in settings): www.china-aiapi.com · https://api.china-aiapi.com/v1

Want more #vscode & #cline deep dives?

Join 5,962+ developers sharing real benchmarks, code breakdowns, and projects. Free forever.

2 Comments

0 votes
0

More Posts

CData's New AI Gateway Puts Context at the Center — Fixes the Three Reasons Enterprise AI Stalls

Tom Smithverified - Sep 28

S-MoE Started to Speak OpenAI — Point Any Chat App at Your MacBook and Watch a 235B Model Think

melasistema - Jul 20

Short links that outlive the vendor: a newsroom URL shortener on WordPress and AWS

jaafarabazid - Nov 10

The Privacy Gap: Why sending financial ledgers to OpenAI is broken

Pocket Portfolio - Feb 23

Automated PR Reviews with Cline and NVIDIA NIM APIs

eraydiler - Oct 6
chevron_left
162 Points • 8 Badges
2Posts
2Comments

Related Jobs

View all jobs →

Commenters (This Week)

6 comments
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!