Skip to content

Latest commit

 

History

History
85 lines (65 loc) · 2.68 KB

File metadata and controls

85 lines (65 loc) · 2.68 KB
title Quickstart: Copilot Runtime
description How to set up Copilot Runtime

import NextJSAppRouterExample from "/snippets/code-snippets/next/route.mdx" import NextJSPagesRouterExample from "/snippets/code-snippets/next-pages/copilotkit.mdx" import NodeExpressExample from "/snippets/code-snippets/node/express.mdx" import NodeHTTPExample from "/snippets/code-snippets/node/server.mdx"

What is Copilot Runtime?

Copilot Runtime is the server-side element of CopilotKit. It is responsible for handling requests from your copilot and sending them to the desired LLM. Copilot Runtime can be hosted on your own infrastructure or via Copilot Cloud.

Option 1: Use Copilot Cloud

Copilot Cloud is the easiest way to get started with CopilotKit. It allows you to start building powerful copilots without having to manage your own infrastructure.

Get a free hosted Copilot Runtime via Copilot Cloud

Try Copilot Cloud
  1. First, sign up to Copilot Cloud
  2. Add your OpenAI API Key
  3. Copy your Copilot Cloud Public API Key

Initialize CopilotKit using Copilot Cloud

Using Copilot Cloud is easy. Simply provide your public API key to the <CopilotKit /> component:

<CopilotKit publicApiKey="Your Copilot Cloud API key">
  ...
</CopilotKit>

Option 2: Host your own Copilot Runtime

Install CopilotKit Backend packages

Install the @copilotkit/runtime package:

```bash npm npm i @copilotkit/runtime ```
  yarn add @copilotkit/runtime
  pnpm add @copilotkit/runtime

Set up the Copilot Runtime endpoint

Make sure you have the OPENAI_API_KEY environment variable set up.

Create a new route to handle the `/api/copilotkit` endpoint: Next.js Pages Router }> Create a new route to handle the `/api/copilotkit` endpoint: Set up a new Express.js app and add set up the Copilot Runtime middleware: Set up a new Express.js app and add set up the Copilot Runtime middleware: Check out [this repository](https://github.com/CopilotKit/copilotkit-firebase-demo) for a full example of how to set up a Copilot Runtime on Firebase Functions.