Cline OpenAI Compatible API: Custom Base URL Setup Guide

Configure a Cline OpenAI-compatible API with a custom base URL, API key, model ID, capability settings, verification steps, and troubleshooting.

O
OurToken Team//14 min
Cline OpenAI Compatible API: Custom Base URL Setup Guide

Using a Cline OpenAI Compatible API lets you keep Cline's coding-agent workflow while choosing a custom API endpoint, model, and billing route. The setup is straightforward when the provider implements the OpenAI-compatible chat interface correctly: select the OpenAI Compatible provider in Cline, enter the provider's base URL and API key, then specify an exact model ID.

The difficult part is not filling in those three fields. It is making sure the endpoint path, model capabilities, context window, tool behavior, and streaming response all match what Cline expects. A connection can pass authentication and still fail when Cline tries to edit files, call tools, process images, or continue a long coding session.

This guide uses OurToken as a working custom-endpoint example, but the verification and troubleshooting process applies to other OpenAI-compatible providers as well. It covers the minimum configuration, a direct API test, model selection, capability settings, cost controls, and the errors that usually appear after the first successful request.

Quick Answer: Cline OpenAI Compatible API Settings

Open Cline's settings and enter these values:

Cline settingExample valueWhat it controls
API ProviderOpenAI CompatibleTells Cline to use the OpenAI-compatible request format
Base URLhttps://api.ourtoken.ai/v1Routes requests to the custom API instead of the official OpenAI endpoint
API KeyYour provider API keyAuthenticates requests and assigns usage to your account
Model IDdeepseek-v4-proSelects the exact model Cline should call

The request path should look like this:

Cline
  |
  | OpenAI-compatible request
  v
https://api.ourtoken.ai/v1/chat/completions
  |
  | model = deepseek-v4-pro
  v
Selected coding model

Do not append /chat/completions to the Base URL field unless the provider's documentation explicitly tells you to do so. Cline normally adds the endpoint path to the configured base URL. For OurToken, use https://api.ourtoken.ai/v1 as the Base URL.

How Cline Uses an OpenAI-Compatible Provider

Cline is more demanding than a simple chat client. A normal chat application sends messages and displays text. Cline also reads repository context, proposes edits, runs commands with approval, interprets tool results, and continues multi-step tasks. The model endpoint therefore needs to support both the request syntax and the behavior required by an agentic coding workflow.

The Three Required Configuration Values

The official Cline OpenAI-compatible provider documentation identifies three core settings:

  1. Base URL: the provider's OpenAI-compatible API root.
  2. API Key: the credential issued by that provider.
  3. Model ID: the exact identifier accepted by the endpoint.

These values form one contract. A valid key cannot compensate for a wrong base URL, and a valid URL cannot infer the intended model. Treat the complete configuration as a versioned environment setting rather than a collection of values developers type from memory.

For example:

Provider: OpenAI Compatible
Base URL: https://api.ourtoken.ai/v1
API Key:  sk-your-provider-key
Model ID: deepseek-v4-pro

The model name must match the provider catalog exactly. Display names such as "Claude Sonnet" or "DeepSeek Pro" are not necessarily callable model IDs.

Compatibility Has Two Layers

It helps to separate protocol compatibility from workflow compatibility.

Compatibility layerQuestionTypical failure
API protocolDoes the endpoint accept OpenAI-shaped requests?HTTP 400, unsupported field, invalid response shape
Coding workflowDoes the selected model behave reliably inside Cline?Missed tool calls, weak edits, repeated plans, incomplete tasks

An endpoint can pass the first layer and still perform poorly at the second. That is why the setup process should include an agentic test, not just a "hello world" prompt.

Where a Unified Endpoint Helps

A custom endpoint is useful when a team wants one credential and one base URL across several coding models. Instead of maintaining separate integrations for each provider, developers can change the model ID while keeping the Cline provider configuration stable.

This is similar to the configuration pattern in the OpenCode custom provider API guide: the coding tool speaks a familiar API format, while the custom provider handles model access behind one endpoint. The exact UI is different, but the operational goal is the same.

Step-by-Step Cline Custom Base URL Setup

The safest setup order is credential, endpoint, model, capabilities, then verification. Changing all settings at once makes failures harder to isolate.

Step 1: Create and Protect the API Key

Create an API key in the provider account you intend to use. For this example, create or manage the credential in the OurToken API key dashboard. Do not paste the key into source files, screenshots, issue reports, or team documentation.

For a team environment, prefer separate keys for each developer or environment:

cline-alice-development
cline-bob-development
cline-ci-review

Separate keys improve revocation, cost attribution, and incident response. If one credential leaks, you can disable it without interrupting every developer.

Step 2: Select OpenAI Compatible in Cline

Open the Cline settings panel and choose OpenAI Compatible as the API provider. Do not choose the official OpenAI option when you need a custom base URL. The OpenAI Compatible option exposes the fields required for third-party and internal endpoints.

The precise settings-panel layout can change between Cline releases, but the required values remain the same: provider type, base URL, API key, and model ID.

Step 3: Enter the Base URL

For OurToken, enter:

https://api.ourtoken.ai/v1

Common URL mistakes include:

  • omitting https://
  • adding a trailing endpoint such as /chat/completions
  • entering the website URL instead of the API URL
  • omitting the required /v1
  • copying a URL that contains spaces or invisible characters

The Base URL should identify the API root. Cline constructs the final request using that root and the appropriate OpenAI-compatible path.

Step 4: Enter an Exact Model ID

Choose a model based on the work you expect Cline to perform, then copy its callable ID exactly.

WorkloadExample model IDWhy it may fit
General coding and repository workdeepseek-v4-proUses the OpenAI-compatible Chat Completions endpoint shown on its model page
Long-context or multilingual workglm-5.2Useful candidate for large context and Chinese-English development tasks

Verify current availability and endpoint details on the DeepSeek V4 Pro API page or GLM 5.2 API page before putting a model into a shared configuration. Both pages currently identify /v1/chat/completions as the API path, which matches Cline's OpenAI Compatible provider.

Do not assume that a display name or alias used by another provider will work. Exact callable IDs make deployments more predictable.

Step 5: Configure Model Capabilities

Cline allows users to describe advanced model capabilities, including context window, maximum output tokens, image support, and computer-use or tool-related behavior. These settings help Cline decide what it can safely send to the model.

Use provider documentation instead of guessing. Incorrect capability values can create subtle failures:

  • An overstated context window can produce request-too-large errors.
  • An understated context window can cause unnecessary truncation.
  • Enabling image support for a text-only route can produce invalid requests.
  • Incorrect output-token limits can cut off code changes or final explanations.
  • Marking a model as tool-capable does not guarantee reliable tool selection.

Start with conservative values, run real tasks, and expand limits only after observing successful requests.

Step 6: Click Verify

Click Verify in Cline after entering the Base URL, API key, model ID, and capability values. A successful verification confirms that Cline can reach the endpoint and that the provider accepts the current credentials and model configuration.

Verification does not prove that editing and tool calls will work reliably. If it fails, recheck the Base URL, key, and model ID, then run the direct API request in the next section. Continue to agentic testing only after verification succeeds.

Step 7: Run Staged Cline Tests

Begin with a small, read-only request:

Read package.json and summarize the available npm scripts. Do not edit files or run commands.

This test confirms that Cline can authenticate, reach the endpoint, send repository context, and receive a usable response. It does not yet prove tool or editing reliability.

Then run a controlled editing task:

Create a new file named cline-connection-test.md containing exactly one line:
Cline edit test passed.
Show the proposed change before applying it.

Finally, test an approved command:

Run the project's existing lint command and summarize any errors. Do not install packages.

These three stages isolate basic chat, file editing, and tool execution. Delete the temporary test file afterward. If the first succeeds and the third fails, the problem is probably not the API key.

Verify the Endpoint Outside Cline

When Cline reports a vague connection error, test the provider directly. This separates endpoint problems from Cline configuration problems.

Direct Chat Completions Test

Use a minimal request with a model ID that is active in your account:

curl https://api.ourtoken.ai/v1/chat/completions \
  -H "Authorization: Bearer $OURTOKEN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-pro",
    "messages": [
      {
        "role": "user",
        "content": "Reply with exactly: connection ok"
      }
    ],
    "stream": false
  }'

On PowerShell, use an environment variable rather than putting the real key into command history:

$headers = @{
  Authorization = "Bearer $env:OURTOKEN_API_KEY"
  "Content-Type" = "application/json"
}

$body = @{
  model = "deepseek-v4-pro"
  messages = @(
    @{
      role = "user"
      content = "Reply with exactly: connection ok"
    }
  )
  stream = $false
} | ConvertTo-Json -Depth 5

Invoke-RestMethod `
  -Uri "https://api.ourtoken.ai/v1/chat/completions" `
  -Method Post `
  -Headers $headers `
  -Body $body

If this direct request fails, fix the key, URL, account balance, or model ID before changing Cline settings. If it succeeds but Cline fails, inspect Cline's provider selection and capability configuration.

Validate Streaming Separately

Cline frequently uses streamed output to keep long coding tasks responsive. A provider may support non-streaming chat completions but implement server-sent events incorrectly.

Repeat the request with "stream": true. A healthy stream should return a sequence of data events and finish cleanly. Truncated JSON, buffered output, or a connection that never closes can explain why a simple test works while Cline appears stuck.

Choosing a Model for Cline

Start with a model whose provider page explicitly supports the OpenAI-compatible Chat Completions path. deepseek-v4-pro is the default example in this guide because its current OurToken page lists /v1/chat/completions and the exact callable model ID.

Use glm-5.2 as an alternative when long-context or Chinese-English repository work is important. Regardless of model, test code navigation, focused edits, existing test commands, and compliance with repository instructions before standardizing it for a team.

Do not select a model only by token price or context-window size. The useful metric is cost per successfully completed coding task, including retries and human corrections.

Tool Calling and Agent Reliability

Cline's value comes from actions, not just answers. It needs models to decide when to read files, search code, propose edits, and run approved commands. OpenAI-compatible syntax helps carry those tool definitions, but runtime behavior still varies by model.

Test Tool Behavior, Not Just Tool Support

A provider may advertise function calling while a specific model still struggles with agentic tasks. Evaluate a small set of observable behaviors:

TestExpected behavior
Read-only repository questionReads relevant files before answering
Small editChanges only the requested lines
Command requestAsks for approval and uses the correct command
Failed commandReads the error and adjusts the plan
Ambiguous requestAsks for clarification instead of making a risky assumption

The OpenAI function calling guide explains the request contract, while the OpenAI-compatible tool calling production guide covers schema validation, retries, provider differences, and fallback behavior across models.

Capability labels are not benchmarks. Track task completion, correct file selection, valid tool calls, test results, and required human corrections whenever you change models or providers.

Cost, Security, and Team Configuration

A custom API changes Cline from an individual application setting into part of the team's developer infrastructure. That requires basic operating controls.

Understand the Cost Drivers

Cline costs are shaped by more than the final answer. Repository context, tool schemas, command output, retries, and repeated file reads all add tokens.

estimated task cost =
  input context cost
  + output token cost
  + cached prompt cost where supported
  + retry and fallback cost

Track cost by completed task type rather than by session duration. A five-minute task that sends a large monorepo can cost more than a thirty-minute focused edit.

Cost driverWhy it growsControl
Repository contextToo many files or long generated outputNarrow the task and exclude generated directories
Tool outputTests and logs return excessive textRun focused commands and summarize large logs
RetriesWrong model or incorrect capabilitiesValidate model behavior before broad rollout

Protect Credentials

Apply the same rules used for production API credentials:

  • never commit API keys
  • never paste keys into prompts
  • rotate exposed credentials immediately
  • use separate keys for users and automation
  • set account-level spending alerts where available
  • remove keys when a developer leaves the team

Avoid sharing one unrestricted key across an organization. Shared credentials make it difficult to identify abnormal use or revoke access safely.

Document the non-secret settings, including the Base URL, approved model IDs, capability values, and verification task. Keep API keys personal and revocable.

Troubleshooting Cline OpenAI-Compatible API Errors

Most setup failures fall into a small number of categories. Diagnose them in order instead of changing several fields at once.

401 Unauthorized or Invalid API Key

Check that:

  • the key belongs to the provider configured in Base URL
  • there are no spaces or quotes around the key
  • the key is active and has available balance or quota
  • a copied key was not truncated
  • the authorization header works in the direct curl test

If the direct request returns 401, the problem is outside Cline.

404 Model Not Found

A 404 or model-not-found message usually means the model ID is wrong or unavailable to the account.

Use exact IDs such as:

deepseek-v4-pro
glm-5.2

Do not replace hyphens with spaces or copy the marketing display name. Confirm that the model is currently listed by the provider.

404 Endpoint Not Found

If authentication succeeds but the endpoint is missing, inspect the Base URL. For OurToken it should be:

https://api.ourtoken.ai/v1

Entering https://ourtoken.ai, omitting /v1, or appending the wrong operation path can produce an endpoint-level 404.

400 Unsupported Parameter

OpenAI compatibility is not always identical across models. Cline may send fields for streaming, tools, images, or token limits that one route does not support.

Disable unverified capabilities, reduce the request to text-only chat, and test again. Then enable features one at a time. The error body often names the unsupported field.

Cline Connects but Does Not Edit Files

This is usually a model-behavior or tool-use problem rather than authentication. Confirm that:

  • the model supports reliable tool or function calling
  • Cline's capability settings match the model
  • the task explicitly requests an edit
  • approval settings allow the proposed action
  • the model is not returning plain text instead of a tool call

Try a smaller edit and compare another coding-capable model through the same endpoint.

Output Stops Mid-Task

Possible causes include:

  • maximum output tokens set too low
  • context window exhausted
  • stream interrupted by the network or provider
  • a command returned too much output
  • the model attempted an unsupported tool sequence

Run the direct streaming test, reduce repository context, and increase only the verified output limit.

The First Task Works but Long Sessions Fail

Long sessions accumulate messages, file contents, tool results, and command output. A model may work well on a clean request but degrade after the context grows.

Start a new Cline task when the objective changes. Ask for concise command output. Avoid loading generated files, dependency directories, and large lockfiles unless they are directly relevant.

Conclusion

A Cline OpenAI-compatible API setup is more than a custom base URL. The reliable configuration combines the correct provider type, API root, protected API key, exact model ID, and conservative capability settings. Verification should then move from direct API access to read-only repository work, controlled edits, and approved command execution.

The most important habit is to test the workflow you actually need. A successful chat response proves connectivity. It does not prove that the model can navigate a repository, call tools correctly, preserve unrelated code, and recover from command failures.

OurToken provides the OpenAI-compatible Base URL used in this guide and access to multiple coding-capable model IDs through one account. Start with a small verification task, measure successful task completion and cost, then standardize the configuration only after the selected model behaves reliably in your repositories.

FAQ

Can Cline use an OpenAI-compatible API?

Yes. Select OpenAI Compatible in Cline, then enter the provider's Base URL, API key, and exact model ID. The provider must implement the request and streaming behavior Cline needs.

What Base URL should I use for OurToken in Cline?

Use https://api.ourtoken.ai/v1. Do not append /chat/completions in the Cline Base URL field unless the current product documentation specifically requires a full endpoint.

Why does Cline say model not found?

The most common cause is an incorrect model ID. Copy the callable ID from the provider's model page and preserve its exact spelling and hyphens. Also verify that the model is enabled for your account.

Which model should I use with Cline?

Start with deepseek-v4-pro, which currently uses the Chat Completions path in this guide, then compare glm-5.2 for long-context or multilingual work. Choose based on completed-task reliability, not only token price or benchmark claims.

Does OpenAI-compatible mean every Cline feature will work?

No. It confirms a common API shape, but models and providers can differ in streaming, tools, image input, token limits, and error handling. Test each capability before relying on it.

How can I test the API before configuring Cline?

Send a minimal request directly to the provider's /chat/completions endpoint with curl or PowerShell. If the direct request fails, fix the key, URL, model ID, or account status before troubleshooting Cline.

Should a team share one Cline API key?

Prefer separate keys for each developer or environment. Individual keys improve revocation, usage attribution, spending controls, and incident response.

Sources