Cline OpenAI Compatible Setup
Configure Cline with OpenAI Compatible API: Step-by-Step Guide
Cline's OpenAI Compatible provider option is the most flexible way to connect to virtually any AI model. It works with relay services, self-hosted models, alternative providers, and any endpoint that implements the OpenAI chat completions API format. This guide provides detailed instructions for setting up and optimizing the OpenAI Compatible configuration in Cline.
Why Use OpenAI Compatible?
The OpenAI Compatible provider in Cline is not just for OpenAI models. It works with any API that follows the OpenAI chat completions format, which has become the industry standard. This includes:
- API relay services like claude4u.com that provide unified access to Claude, Gemini, GPT, and more
- Self-hosted models running on Ollama, vLLM, llama.cpp, or text-generation-webui
- Alternative providers like Together AI, Groq, Fireworks, DeepSeek, and Mistral
- Azure OpenAI endpoints
- AWS Bedrock with compatible proxy layers
Step-by-Step Configuration
- Open VS Code and click the Cline icon in the sidebar.
- Click the settings gear icon in the Cline panel.
- In the API Provider dropdown, select "OpenAI Compatible".
- Fill in the required fields as described below.
Configuration Fields Explained
// Required fields:
Base URL: https://claude4u.com/v1
API Key: cr_your-api-key-here
Model ID: claude-sonnet-4-20250514
// The Base URL should NOT include /chat/completions
// Cline appends the endpoint path automatically
- Base URL: The root URL of your API endpoint. Do not include
/chat/completionsat the end — Cline appends this automatically. Example:https://claude4u.com/v1 - API Key: Your authentication key for the API endpoint. The format depends on your provider.
- Model ID: The exact model identifier that the API endpoint expects. This must match exactly — check your provider's documentation for valid model names.
https://provider.com/v1/chat/completions in the Base URL field. Only include the base path up to and including /v1. Cline adds the rest of the URL automatically.Configuration Examples for Popular Services
claude4u.com Relay Service
Base URL: https://claude4u.com/v1
API Key: cr_your-relay-key
Model ID: claude-sonnet-4-20250514
// Also supports: gemini-2.5-flash, gemini-2.5-pro, gpt-4o, etc.
Local Ollama Server
Base URL: http://localhost:11434/v1
API Key: ollama (any non-empty string)
Model ID: deepseek-coder-v2:latest
Together AI
Base URL: https://api.together.xyz/v1
API Key: your-together-api-key
Model ID: meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo
Groq
Base URL: https://api.groq.com/openai/v1
API Key: your-groq-api-key
Model ID: llama-3.3-70b-versatile
DeepSeek
Base URL: https://api.deepseek.com/v1
API Key: your-deepseek-api-key
Model ID: deepseek-chat
Testing Your Configuration
After entering your configuration details, test the connection:
- Open the Cline chat panel.
- Send a simple message like
Hello, what model are you? - Verify that you receive a response and that the model identifies itself correctly.
- Try a coding task like
Create a simple Python hello world scriptto confirm file editing works.
Advanced Configuration
Streaming
Cline uses streaming by default for real-time token display. Most OpenAI-compatible endpoints support streaming. If you experience issues with a provider that does not support streaming, check the Cline settings for a streaming toggle.
Custom Headers
Some providers require additional headers for authentication or routing. If your provider needs custom headers, you may need to configure them through environment variables or proxy settings. Common examples include:
# For Azure OpenAI:
# The API key is typically sent as "api-key" header
# Base URL format: https://your-resource.openai.azure.com/openai/deployments/your-deployment
# For providers behind Cloudflare Access:
# You may need CF-Access-Client-Id and CF-Access-Client-Secret headers
Troubleshooting
- "Failed to connect" error: Verify the Base URL is correct, includes the protocol (https://), and is accessible from your machine. Test with
curl https://your-base-url/v1/models -H "Authorization: Bearer your-key" - "Model not found" error: The Model ID does not match any model on the provider. List available models with a GET request to
/v1/models. - "Authentication failed" error: Verify your API key is correct with no extra spaces. Some providers use Bearer token auth while others use different schemes.
- Empty responses: The model may not support streaming, or the response format may differ from what Cline expects. Try a different model or check provider compatibility.
- Slow responses: If using a local model, check GPU utilization. For remote providers, check network connectivity and consider a geographically closer endpoint.
Switching Between Providers
You can quickly switch between different API configurations in Cline by changing the provider dropdown. Your settings for each provider are saved separately, so you can easily switch between your relay service, local Ollama, and direct provider access without re-entering credentials each time.
For the most flexible setup, configure a relay service like claude4u.com as your primary provider. This gives you access to multiple models through a single endpoint, and you only need to change the Model ID field to switch between Claude, Gemini, GPT, and other models.
Get Started with 轻舟 AI
Stable, fast AI API relay — supports Claude, OpenAI, Gemini and more
Sign Up Free
轻舟 AI