import { CopilotKit } from "@copilotkit/react-core";

<CopilotKit 
  runtimeUrl="https://your.copilotkit.api">
  <YourApp/>
</CopilotKit>

This component provides the Copilot context to its children. It can be configured either with a chat API endpoint or a CopilotApiConfig.

The backend can use OpenAI, or you can bring your own LLM. For examples of the backend api implementation, see examples/next-openai or the runtime docs.

import { CopilotKit } from "@copilotkit/react-core";

<CopilotKit 
  runtimeUrl="https://your.copilotkit.api">
  <YourApp/>
</CopilotKit>

Example usage

<CopilotKit publicApiKey="the api key or self host (see below)">
  <App />
</CopilotKit>

Props

publicApiKey
string

Your Copilot Cloud API key.

cloudRestrictToTopic
{ validTopics?: string[]; invalidTopics?: string[]; }

Cloud feature: Restrict input to a specific topic.

runtimeUrl
string

the endpoint for the Copilot Runtime instance.

transcribeAudioUrl
string

The endpoint for the Copilot transcribe audio service.

textToSpeechUrl
string

The endpoint for the Copilot text to speech service.

headers
Record<string, string>

Additional headers to be sent with the request.

For example:

{
  'Authorization': 'Bearer your_token_here'
}
body
Record<string, any>

Additional body params to be sent with the request For example:

{
  'message': 'Hello, world!'
}
children
ReactNode
required

The children to be rendered within the CopilotKit.

backendOnlyProps
Record<string, any>

Backend only props that will be combined to body params to be sent with the request For example:

{
  'user_id': 'users_id',
}
credentials
RequestCredentials

Indicates whether the user agent should send or receive cookies from the other domain in the case of cross-origin requests.