From 8109413a5441237d7376ab6738d9f4fa3b1cb0a5 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Wed, 4 Feb 2026 11:52:17 +0530 Subject: [PATCH 1/3] Add copilotkit sdk doc as supported agents sdk --- .../docs/tutorials/copilotkit_sdk.md | 98 +++++++++++++++++++ docs/my-website/sidebars.js | 1 + 2 files changed, 99 insertions(+) create mode 100644 docs/my-website/docs/tutorials/copilotkit_sdk.md diff --git a/docs/my-website/docs/tutorials/copilotkit_sdk.md b/docs/my-website/docs/tutorials/copilotkit_sdk.md new file mode 100644 index 0000000000..551120211f --- /dev/null +++ b/docs/my-website/docs/tutorials/copilotkit_sdk.md @@ -0,0 +1,98 @@ +import Tabs from '@theme/Tabs'; +import TabItem from '@theme/TabItem'; + +# CopilotKit SDK with LiteLLM + +Use CopilotKit SDK with any LLM provider through LiteLLM Proxy. + +CopilotKit provides a framework for building AI copilots in your applications. By pointing it to LiteLLM, you can use any LLM provider while building copilot experiences. + +## Quick Start + +### 1. Add Model to Config + +```yaml title="config.yaml" +model_list: + - model_name: claude-sonnet-4-5 + litellm_params: + model: "anthropic/claude-sonnet-4-5-20250514-v1:0" + api_key: "os.environ/ANTHROPIC_API_KEY" +``` + +### 2. Start LiteLLM Proxy + +```bash +litellm --config config.yaml +``` + +### 3. Use CopilotKit SDK + +```typescript +import OpenAI from "openai"; +import { + CopilotRuntime, + OpenAIAdapter, + copilotRuntimeNextJSAppRouterEndpoint, +} from "@copilotkit/runtime"; +import { NextRequest } from "next/server"; + +const model = "claude-sonnet-4-5"; + +const openai = new OpenAI({ + apiKey: process.env.OPENAI_API_KEY || "sk-12345", + baseURL: process.env.OPENAI_BASE_URL || "http://localhost:4000/v1", +}); + +const serviceAdapter = new OpenAIAdapter({ openai, model }); +const runtime = new CopilotRuntime(); + +export const POST = async (req: NextRequest) => { + const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint({ + runtime, + serviceAdapter, + endpoint: "/api/copilotkit", + }); + return handleRequest(req); +}; +``` + +### 4. Test + +```bash +curl -X POST http://localhost:3000/api/copilotkit \ + -H "Content-Type: application/json" \ + -d '{ + "method": "agent/run", + "params": { + "agentId": "default" + }, + "body": { + "threadId": "your_thread_id", + "runId": ""your_run_id"", + "tools": [], + "context": [], + "forwardedProps": {}, + "state": {}, + "messages": [ + { + "id": "166e573e-f7c6-4c0f-8685-04dbefec18be", + "content": "Hi", + "role": "user" + } + ] + } +}' +``` + +## Environment Variables + +| Variable | Value | Description | +|----------|-------|-------------| +| `OPENAI_API_KEY` | `sk-12345` | Your LiteLLM API key | +| `OPENAI_BASE_URL` | `http://localhost:4000/v1` | LiteLLM proxy URL | + + +## Related Resources + +- [CopilotKit Documentation](https://docs.copilotkit.ai) +- [LiteLLM Proxy Quick Start](../proxy/quick_start) diff --git a/docs/my-website/sidebars.js b/docs/my-website/sidebars.js index 98c8ee6eaa..f7b54c6f12 100644 --- a/docs/my-website/sidebars.js +++ b/docs/my-website/sidebars.js @@ -150,6 +150,7 @@ const sidebars = { }, items: [ "tutorials/claude_agent_sdk", + "tutorials/copilotkit_sdk", "tutorials/google_adk", ] }, From 465bbf35146b35cec1d36b75297820a37b303524 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Wed, 4 Feb 2026 11:53:49 +0530 Subject: [PATCH 2/3] Add copilotkit sdk doc as supported agents sdk --- docs/my-website/docs/tutorials/copilotkit_sdk.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/my-website/docs/tutorials/copilotkit_sdk.md b/docs/my-website/docs/tutorials/copilotkit_sdk.md index 551120211f..594195b1fb 100644 --- a/docs/my-website/docs/tutorials/copilotkit_sdk.md +++ b/docs/my-website/docs/tutorials/copilotkit_sdk.md @@ -5,7 +5,8 @@ import TabItem from '@theme/TabItem'; Use CopilotKit SDK with any LLM provider through LiteLLM Proxy. -CopilotKit provides a framework for building AI copilots in your applications. By pointing it to LiteLLM, you can use any LLM provider while building copilot experiences. +> **Note:** CopilotKit SDK integration with LiteLLM Proxy works with LiteLLM v1.81.7-nightly or higher. + ## Quick Start From cdd45690645dc5a63480ad4cb6d784acdabebcd8 Mon Sep 17 00:00:00 2001 From: Sameer Kankute Date: Wed, 4 Feb 2026 11:56:17 +0530 Subject: [PATCH 3/3] Apply suggestion from @greptile-apps[bot] Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --- docs/my-website/docs/tutorials/copilotkit_sdk.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/my-website/docs/tutorials/copilotkit_sdk.md b/docs/my-website/docs/tutorials/copilotkit_sdk.md index 594195b1fb..fc4db8bfe3 100644 --- a/docs/my-website/docs/tutorials/copilotkit_sdk.md +++ b/docs/my-website/docs/tutorials/copilotkit_sdk.md @@ -67,7 +67,7 @@ curl -X POST http://localhost:3000/api/copilotkit \ "params": { "agentId": "default" }, - "body": { + "runId": "your_run_id", "threadId": "your_thread_id", "runId": ""your_run_id"", "tools": [],