← Back to Blog

Connect the Cline VS Code Extension to a Custom API

Zivv14 min read
ClineVS Codesetup

Cline is an agentic coding extension: it reads files, plans, edits, and runs commands, and every one of those steps is an API call carrying your project context. That makes two things matter more than in a normal chat client — which endpoint you connect it to, and how you stop context from inflating your bill. This guide covers both supported routes into a gateway (OpenAI-compatible and Anthropic) and the habits that keep Cline's token usage sane.

Two Ways to Connect

Cline's provider dropdown includes both an Anthropic provider and an OpenAI Compatible provider, and Zivv exposes both protocols on one key:

SettingAnthropic providerOpenAI Compatible provider
Base URLhttps://zivv.prohttps://zivv.pro/v1
API keyYour sk- keyYour sk- key
Model IDclaude-sonnet-5Any model from Model Hub
Best forClaude models with native featuresMixing Claude, GPT, and Gemini models

Note the base URL difference: the Anthropic protocol uses the root domain, the OpenAI protocol adds /v1. Swapping them is the most common misconfiguration.

Option A: Anthropic Provider

Use this when Cline will mainly run Claude models — the native protocol keeps features like prompt caching working exactly as the Anthropic SDK expects.

  1. Open Cline's settings inside VS Code
  2. Select the Anthropic provider
  3. Enable the custom base URL option and enter https://zivv.pro
  4. Paste your sk- key
  5. Set the model to a current Claude ID such as claude-sonnet-5

Verify the same values outside VS Code if anything fails:

curl https://zivv.pro/v1/messages \
  -H "x-api-key: sk-your-key-here" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5",
    "max_tokens": 128,
    "messages": [{"role": "user", "content": "Reply OK"}]
  }'

Option B: OpenAI Compatible Provider

Use this when you want one provider entry that can switch between model families — Claude for hard refactors, gpt-5.4 for routine edits, gemini-3.5-flash for cheap summarization.

  1. Select the OpenAI Compatible provider in Cline's settings
  2. Base URL: https://zivv.pro/v1
  3. API key: your sk- key
  4. Model ID: the exact id from Model Hub

The matching curl test:

curl https://zivv.pro/v1/chat/completions \
  -H "Authorization: Bearer sk-your-key-here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-5.4",
    "messages": [{"role": "user", "content": "Reply OK"}]
  }'

If curl works and Cline does not, re-paste the values (watch for trailing spaces) and reload the VS Code window. A 401 or 404 that also appears in curl is a key or model-name problem — the 404 model guide has the checklist.

Why Cline Burns Tokens Faster Than Chat

A chat client sends your message plus some history. Cline sends your message, its system prompt, the conversation so far, the contents of every file it has read, and the output of every command it has run — on every request. A task that touches ten files can easily carry tens of thousands of input tokens per step, and a long-running task re-sends that context dozens of times.

This is not a bug; it is how an agent keeps enough state to act. But it means input tokens, not output tokens, dominate Cline's cost, and controlling them is worth more than any per-token price difference.

Keeping Context Costs Under Control

  • Scope the workspace. Open the subfolder you are working on, not a monorepo root. Less visible surface means fewer accidental large reads.
  • Exclude noise with `.clineignore`. Keep build output, lockfiles, fixtures, and generated code out of Cline's reach the same way .gitignore keeps them out of commits.
  • Start a new task per feature. Context accumulates for the life of a task. Finishing a task and starting fresh resets the payload; one endless task is the most expensive way to use Cline.
  • Split model tiers by phase. Plan with a cheaper model like gemini-3.5-flash or gpt-5.4, then switch to claude-sonnet-5 for the implementation steps that need it.
  • Do not paste what Cline can read. Pasting a 2,000-line log into the chat puts it in every subsequent request. Point Cline at the file instead, and trim the log first.
  • Cap the key. Give the Cline key its own budget in the console so a runaway task stalls the key, not your whole balance. Teams can assign per-member keys and budgets through Teams.

Quick Reference: Which Provider When

SituationChoose
Claude-only workflow, want prompt cachingAnthropic provider
Switching between model familiesOpenAI Compatible provider
Also using Claude Code alongside ClineEither — same key works for both

FAQ

Do I need separate keys for the two provider types? No. The same Zivv key authenticates both protocols. Separate keys per tool are still a good idea for usage tracking, but not a technical requirement.

Which route is cheaper? Pricing is per model, not per protocol. The same model costs the same through either provider entry; choose by workflow, not by price.

Cline says the model does not support computer use or tools — why? Capability varies by model, not by the gateway. Pick a current model that supports tool use for agentic tasks; check descriptions in Model Hub.

My bill jumped after a long session. What happened? Almost always context accumulation: one long task re-sending a large history plus file contents on every step. Check the usage page to confirm which key and model produced the spend, then split future work into shorter tasks and move planning steps to a cheaper model.

Does Cline work alongside Claude Code on the same key? Yes, and it is a common pairing: Claude Code in the terminal for long sessions, Cline inside VS Code for in-editor tasks. Usage from both shows up separately if you give each tool its own key.

Wrap-Up

Connecting Cline is five fields; running it affordably is the habits above. One key on a gateway gives Cline, Claude Code, and Cursor the same model catalog and one usage dashboard — create a key and see the full client list on the vibe coding page.