iframes

Cohere supports viewing and interacting with iframes under the same TLD in your web app. Due to browser restrictions around cross-origin site access, Cohere needs to be initialized in the parent site as well as the iframe.

In the parent, initialize Cohere as normal:

Cohere.init("INSERT_API_KEY_HERE");

In the iframe, initialize Cohere with the childIframe flag set:

Cohere.init("INSERT_API_KEY_HERE", { childIframe: true });

With this flag set, the iframe will no longer be listed as a separate session in the Cohere dashboard. Instead, it will display normally inside the parent session.