Skip to content

Latest commit

 

History

History
82 lines (56 loc) · 2.61 KB

File metadata and controls

82 lines (56 loc) · 2.61 KB
title Quickstart: Copilot Runtime
description How to setup the CopilotRuntime endpoints

Option 1: Use Copilot Cloud

Get a free hosted Copilot Runtime via Copilot Cloud:

Try Copilot Cloud

Initialize CopilotKit using your public API key:

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

Option 2: Host your own Copilot Runtime

Install CopilotKit Backend packages

Install the CopilotKit backend packages:

  npm i @copilotkit/backend
  yarn add @copilotkit/backend
  pnpm add @copilotkit/backend

Manually specified endpoint: Next.js edge function (typescript)

Remember to add any required environment variables. E.g. to use OpenAI:

OPENAI_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
<iframe frameBorder="0" scrolling="no" style={{ width: "100%", height: "205px" }} allow="clipboard-write" src="https://emgithub.com/iframe.html?target=https%3A%2F%2Fgithub.com%2FCopilotKit%2FCopilotKit%2Fblob%2Fmain%2FCopilotKit%2Fscripts%2Fqa%2Flib%2Fnext%2Froute.ts&style=default&type=code&showBorder=on&showLineNumbers=on&showFileMeta=on&showFullPath=on&showCopy=on" ></iframe>

Manually specified endpoint: Next.js pages router

<iframe frameBorder="0" scrolling="no" style={{ width: "100%", height: "331px" }} allow="clipboard-write" src="https://emgithub.com/iframe.html?target=https%3A%2F%2Fgithub.com%2FCopilotKit%2FCopilotKit%2Fblob%2Fmain%2FCopilotKit%2Fscripts%2Fqa%2Flib%2Fnext-pages%2Fcopilotkit.ts&style=default&type=code&showBorder=on&showLineNumbers=on&showFileMeta=on&showFullPath=on&showCopy=on"></iframe>

Manually specified endpoint: Node.js (typescript)

Remember to add any required environment variables. E.g. to use OpenAI:

<iframe frameBorder="0" scrolling="no" style={{ width: "100%", height: "541px" }} allow="clipboard-write" src="https://emgithub.com/iframe.html?target=https%3A%2F%2Fgithub.com%2FCopilotKit%2FCopilotKit%2Fblob%2Fmain%2FCopilotKit%2Fscripts%2Fqa%2Flib%2Fnode%2Fserver.js&style=default&type=code&showBorder=on&showLineNumbers=on&showFileMeta=on&showFullPath=on&showCopy=on" ></iframe>

Firebase (GCP) Cloud Function (typescript)

See this repo for a full example: https://github.com/CopilotKit/copilotkit-firebase-demo