diff --git a/app/components/APIKeyInput.tsx b/app/components/APIKeyInput.tsx
index 580727fb..27516ec8 100644
--- a/app/components/APIKeyInput.tsx
+++ b/app/components/APIKeyInput.tsx
@@ -1,9 +1,11 @@
import { Icon, useBreakpoint, useEditor, useValue } from '@tldraw/tldraw'
-import { ChangeEvent, useCallback, useState } from 'react'
+import { ChangeEvent, useCallback, useEffect, useState } from 'react'
+import { useOpenRouter } from '../hooks/useOpenRouter'
export function APIKeyInput() {
const breakpoint = useBreakpoint()
const [cool, setCool] = useState(false)
+ const { apiKey, getCode, removeApiKey } = useOpenRouter()
const editor = useEditor()
const isFocusMode = useValue('is focus mode', () => editor.getInstanceState().isFocusMode, [
@@ -28,7 +30,7 @@ export function APIKeyInput() {
}, [])
const handleQuestionClick = useCallback(() => {
- const message = `Sorry, this is weird. The OpenAI APIs that we use are very new. If you have an OpenAI developer key, you can put it in this input and we'll use it. We don't save / store / upload these.\n\nSee https://platform.openai.com/api-keys to get a key.\n\nThis app's source code: https://github.com/tldraw/draw-a-ui`
+ const message = `OpenRouter lets app leverage AI without breaking the developer's bank - users pay for what they use!\n\nThis app's source code: https://github.com/tldraw/draw-a-ui`
window.alert(message)
}, [])
@@ -37,16 +39,27 @@ export function APIKeyInput() {
return (