sunpeak APIDocumentation Index
Fetch the complete documentation index at: https://sunpeak.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Host detection utilities help you identify which host (ChatGPT, Claude, etc.) is running your app, so you can conditionally use host-specific features.Import
detectHost
Detect the current host.Signature
Host Type
Detection Order
- Runtime objects — checks for
window.openai(injected by ChatGPT and by the inspector when ChatGPT host is selected) - User agent — checks
navigator.userAgentfor host identifiers - Hostname — checks
window.location.hostnamefor known host domains
Usage
isChatGPT
Check if the app is running in a ChatGPT host.Signature
Usage
isClaude
Check if the app is running in a Claude host.Signature
Usage
Inspector Behavior
In the Inspector, host detection reflects the currently selected host:| Host selected | isChatGPT() | isClaude() | detectHost() |
|---|---|---|---|
| ChatGPT | true | false | 'chatgpt' |
| Claude | false | false* | 'unknown'* |
useHostContext() to read host identity from the MCP protocol instead.
See Also
ChatGPT Hooks
Host-specific hooks for ChatGPT features.
useHostContext
Read host identity and capabilities via the MCP protocol.