Documentation Index Fetch the complete documentation index at: https://docs.cline.bot/llms.txt
Use this file to discover all available pages before exploring further.
The Cline API is OpenAI-compatible, so any library or tool that works with OpenAI also works with the Cline API. Just change the base URL and API key.
curl
Non-Streaming
curl -X POST https://api.cline.bot/api/v1/chat/completions \
-H "Authorization: Bearer $CLINE_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-4-6",
"messages": [{"role": "user", "content": "What is 2+2?"}],
"stream": false
}'
Streaming
curl -X POST https://api.cline.bot/api/v1/chat/completions \
-H "Authorization: Bearer $CLINE_API_KEY " \
-H "Content-Type: application/json" \
-d '{
"model": "anthropic/claude-sonnet-4-6",
"messages": [{"role": "user", "content": "Write a short poem about code."}],
"stream": true
}'
Python
OpenAI SDK
The OpenAI Python SDK works with the Cline API by setting base_url:
from openai import OpenAI
client = OpenAI(
base_url = "https://api.cline.bot/api/v1" ,
api_key = "YOUR_API_KEY" ,
)
# Non-streaming
response = client.chat.completions.create(
model = "anthropic/claude-sonnet-4-6" ,
messages = [{ "role" : "user" , "content" : "Explain recursion in one sentence." }],
)
print (response.choices[ 0 ].message.content)
Streaming in Python
from openai import OpenAI
client = OpenAI(
base_url = "https://api.cline.bot/api/v1" ,
api_key = "YOUR_API_KEY" ,
)
stream = client.chat.completions.create(
model = "anthropic/claude-sonnet-4-6" ,
messages = [{ "role" : "user" , "content" : "Write a function to reverse a string in Python." }],
stream = True ,
)
for chunk in stream:
content = chunk.choices[ 0 ].delta.content
if content:
print (content, end = "" , flush = True )
print ()
from openai import OpenAI
import json
client = OpenAI(
base_url = "https://api.cline.bot/api/v1" ,
api_key = "YOUR_API_KEY" ,
)
tools = [
{
"type" : "function" ,
"function" : {
"name" : "get_weather" ,
"description" : "Get weather for a location" ,
"parameters" : {
"type" : "object" ,
"properties" : {
"location" : { "type" : "string" , "description" : "City name" }
},
"required" : [ "location" ],
},
},
}
]
response = client.chat.completions.create(
model = "anthropic/claude-sonnet-4-6" ,
messages = [{ "role" : "user" , "content" : "What's the weather in Tokyo?" }],
tools = tools,
)
# Check if the model wants to call a tool
choice = response.choices[ 0 ]
if choice.message.tool_calls:
tool_call = choice.message.tool_calls[ 0 ]
print ( f "Tool: { tool_call.function.name } " )
print ( f "Args: { tool_call.function.arguments } " )
Using requests
If you prefer not to use the OpenAI SDK:
import requests
response = requests.post(
"https://api.cline.bot/api/v1/chat/completions" ,
headers = {
"Authorization" : "Bearer YOUR_API_KEY" ,
"Content-Type" : "application/json" ,
},
json = {
"model" : "anthropic/claude-sonnet-4-6" ,
"messages" : [{ "role" : "user" , "content" : "Hello!" }],
"stream" : False ,
},
)
data = response.json()
print (data[ "choices" ][ 0 ][ "message" ][ "content" ])
Node.js / TypeScript
OpenAI SDK
The OpenAI Node.js SDK works with the Cline API by setting baseURL:
import OpenAI from "openai"
const client = new OpenAI ({
baseURL: "https://api.cline.bot/api/v1" ,
apiKey: "YOUR_API_KEY" ,
})
// Non-streaming
const response = await client . chat . completions . create ({
model: "anthropic/claude-sonnet-4-6" ,
messages: [{ role: "user" , content: "Explain async/await in one sentence." }],
})
console . log ( response . choices [ 0 ]. message . content )
Streaming in Node.js
import OpenAI from "openai"
const client = new OpenAI ({
baseURL: "https://api.cline.bot/api/v1" ,
apiKey: "YOUR_API_KEY" ,
})
const stream = await client . chat . completions . create ({
model: "anthropic/claude-sonnet-4-6" ,
messages: [{ role: "user" , content: "Write a haiku about TypeScript." }],
stream: true ,
})
for await ( const chunk of stream ) {
const content = chunk . choices [ 0 ]?. delta ?. content
if ( content ) {
process . stdout . write ( content )
}
}
console . log ()
Using fetch
const response = await fetch ( "https://api.cline.bot/api/v1/chat/completions" , {
method: "POST" ,
headers: {
Authorization: "Bearer YOUR_API_KEY" ,
"Content-Type" : "application/json" ,
},
body: JSON . stringify ({
model: "anthropic/claude-sonnet-4-6" ,
messages: [{ role: "user" , content: "Hello!" }],
stream: false ,
}),
})
const data = await response . json ()
console . log ( data . choices [ 0 ]. message . content )
Cline CLI
The Cline CLI is the fastest way to use the Cline API from your terminal. It handles authentication, streaming, and tool execution for you.
Setup
# Install
npm install -g @anthropic-ai/cline
# Authenticate with a Cline API key
cline auth -p cline -k "YOUR_API_KEY" -m anthropic/claude-sonnet-4-6
Run Tasks
# Simple prompt
cline "Explain what a REST API is."
# Pipe input
cat README.md | cline "Summarize this document."
# Use a specific model
cline -m google/gemini-2.5-pro "Analyze this codebase."
# YOLO mode for automation
cline -y "Run tests and fix failures."
See the CLI Reference for all commands and options.
VS Code / JetBrains
The Cline extension handles the API integration for you:
Open the Cline panel in your editor
Select Cline as the provider in the model picker
Sign in with your Cline account
Start chatting or give Cline a task
Your API key is managed automatically. No manual configuration needed.
For setup instructions, see Installing Cline and Authorizing with Cline .
Chat Completions Full endpoint reference with all parameters.
Authentication API key management and security practices.
Models Browse available models.
CLI Reference Complete Cline CLI command reference.