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

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

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

.env.local
OPENAI_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Manually specified endpoint: Next.js pages router

Manually specified endpoint: Node.js (typescript)

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

Firebase (GCP) Cloud Function (typescript)

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