MIT License

项目介绍

YourGPT/copilot-sdk 是一个托管在 GitHub 上的开源项目,主要使用 TypeScript 编写,采用 MIT License 许可证,目前获得 65 个 Star、10 次 Fork。

仓库全名
YourGPT/copilot-sdk
开源许可证
MIT License
Star 数
65
Fork 数
10
未关闭 Issue
38

README 摘要

Build AI Copilots for Your Product Production-ready AI Copilots for any product. Connect any LLM, deploy on your infrastructure, own your data. Built for speed and control. Documentation Quick Start Install Frontend (React) Backend (Next.js) LLM SDK - Multi-Provider Support Use any LLM provider with a unified API: SDK Requirements Provider | SDK Required | OpenAI, Google, xAI | openai | Anthropic | @anthropic-ai/sdk…

完整内容见 GitHub 原始 README 或本页 。

常见问题

copilot-sdk 用什么语言开发?

主要使用 TypeScript 编写,采用 MIT License 许可证,目前有 65 个 Star。

copilot-sdk 可以免费商用吗?

仓库采用 MIT License 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 copilot-sdk 的源码?

可以直接克隆仓库:git clone https://github.com/YourGPT/copilot-sdk.git,默认分支为 main;安装与运行步骤见仓库 README。

copilot-sdk 最近还在维护吗?

仓库最近一次更新为 2 周前,当前有 38 个未关闭 Issue;Star 数为 65,可作为社区活跃度的参考。

关于

Copilot SDK for building Production-ready AI Copilots for any product. Connect any LLM, deploy on your infrastructure, own your data. Built for speed and control.

描述取自 GitHub 官方 API,中文内容由 GitRead 中文社区 编辑团队整理。

简要分析

热度分
86
价值分
40
活跃状态
活跃

语言占比

CSS
HTML
JavaScript
MDX
Shell
TypeScript

Release

README

Copilot SDK

Build AI Copilots for Your Product

Production-ready AI Copilots for any product. Connect any LLM, deploy on your infrastructure, own your data. Built for speed and control.

npm version npm downloads MIT License PRs Welcome GitHub Stars

Documentation


Copilot SDK Demo

Quick Start

Install

npm install @yourgpt/copilot-sdk @yourgpt/llm-sdk openai

Frontend (React)

import { CopilotProvider } from "@yourgpt/copilot-sdk/react";
import { CopilotChat } from "@yourgpt/copilot-sdk/ui";
import "@yourgpt/copilot-sdk/ui/styles.css";

function App() {
  return (
    <CopilotProvider runtimeUrl="/api/chat">
      <YourApp />
      <CopilotChat />
    </CopilotProvider>
  );
}

Backend (Next.js)

// app/api/chat/route.ts
import { streamText } from "@yourgpt/llm-sdk";
import { openai } from "@yourgpt/llm-sdk/openai";

export async function POST(req: Request) {
  const { messages } = await req.json();

  const result = await streamText({
    model: openai("gpt-4o"),
    system: "You are a helpful assistant.",
    messages,
  });

  return result.toTextStreamResponse();
}

LLM SDK - Multi-Provider Support

Use any LLM provider with a unified API:

import { streamText } from "@yourgpt/llm-sdk";
import { openai } from "@yourgpt/llm-sdk/openai";
import { anthropic } from "@yourgpt/llm-sdk/anthropic";
import { google } from "@yourgpt/llm-sdk/google";
import { xai } from "@yourgpt/llm-sdk/xai";

// OpenAI
await streamText({ model: openai("gpt-4o"), messages });

// Anthropic
await streamText({ model: anthropic("claude-sonnet-4-20250514"), messages });

// Google Gemini (uses OpenAI-compatible API)
await streamText({ model: google("gemini-2.0-flash"), messages });

// xAI Grok (uses OpenAI-compatible API)
await streamText({ model: xai("grok-3-fast"), messages });

SDK Requirements

Provider SDK Required
OpenAI, Google, xAI openai
Anthropic @anthropic-ai/sdk

Server-Side Tools

Add tools to let the AI call functions on your server:

import { streamText, tool } from "@yourgpt/llm-sdk";
import { openai } from "@yourgpt/llm-sdk/openai";
import { z } from "zod";

const result = await streamText({
  model: openai("gpt-4o"),
  messages,
  tools: {
    getWeather: tool({
      description: "Get current weather for a city",
      parameters: z.object({
        city: z.string().describe("City name"),
      }),
      execute: async ({ city }) => {
        const data = await fetchWeatherAPI(city);
        return { temperature: data.temp, condition: data.condition };
      },
    }),
  },
  maxSteps: 5,
});

return result.toDataStreamResponse();

Packages

Package Description
@yourgpt/copilot-sdk/react React hooks and provider
@yourgpt/copilot-sdk/ui Pre-built chat components
@yourgpt/copilot-sdk/core Core utilities and context capture tools
@yourgpt/llm-sdk Multi-provider LLM SDK with streaming

Documentation

Visit copilot-sdk.yourgpt.ai for full documentation.


Contributing

We welcome contributions! Whether it’s bug reports, feature requests, or code contributions.

Maintainers: @0fficialRohit · @rege_dev


License

MIT License

评论

暂无评论