npx @raptrx/askai init scaffolds the config and core library, then add button | link | dropdown copies editable components into your project.buildPromptUrl and openInAI build AI prompt deep links in any JS/TS app — vanilla, React, Next.js, Remix, and more.AskAIButton, AskAILink (SSR-friendly), and AskAIDropdown — plain React components you style with your own design system.1npx @raptrx/askai init
123456your-project/ ├── askai.json # Config ├── src/ │ ├── lib/askai.ts # AI services (you own this) │ └── components/askai/ │ └── ask-ai-button.tsx # Components (you own this)
123npx @raptrx/askai add button # AskAIButton npx @raptrx/askai add link # AskAILink npx @raptrx/askai add dropdown # AskAIDropdown
content — the text or data sent to the AI when the button is clicked. service picks the target chat and goal sets the instruction:1234567import { AskAIButton } from '@/components/askai/ask-ai-button'; <AskAIButton service="chatgpt" goal="Explain this code" content={codeString} />
AskAILink renders a plain anchor, which makes it SSR-friendly:123456789import { AskAILink } from '@/components/askai/ask-ai-link'; <AskAILink service="claude" goal="Review this" content={codeString} > Ask Claude </AskAILink>
AskAIDropdown lets the user pick from multiple services:1234567import { AskAIDropdown } from '@/components/askai/ask-ai-dropdown'; <AskAIDropdown goal="Explain this code" content={codeString} services={['chatgpt', 'claude', 'gemini', 'perplexity']} />
1234567import { buildPromptUrl, openInAI } from '@/lib/askai'; // Get URL const url = buildPromptUrl('chatgpt', 'Explain this', code); // Or open directly openInAI('claude', 'Review this', code);
123456789101112function CodeBlock({ code, language }) { return ( <div> <pre>{code}</pre> <AskAIDropdown goal={`Explain this ${language} code`} content={code} services={['chatgpt', 'claude']} /> </div> ); }
1234567891011121314function ErrorBoundary({ error }) { return ( <div> <p>Something went wrong</p> <AskAIButton service="chatgpt" goal="Help me fix this error" content={error.stack} > Ask AI for Help </AskAIButton> </div> ); }
id value as the service prop on components or the first argument to buildPromptUrl / openInAI:| Service | ID | URL |
| ChatGPT | chatgpt | chat.openai.com |
| Claude | claude | claude.ai |
| Gemini | gemini | gemini.google.com |
| Grok | grok | grok.x.ai |
| Perplexity | perplexity | perplexity.ai |
| DeepSeek | deepseek | chat.deepseek.com |
| Mistral | mistral | chat.mistral.ai |
| Copilot | copilot | copilot.microsoft.com |
| Kagi | kagi | kagi.com |
| Google AI Studio | google | aistudio.google.com |
maxLength, which avoids 414 URI Too Long errors, and code content is wrapped in markdown code blocks so the AI receives it well-formatted.init writes an askai.json at your project root that records where the generated code lives:123456{ "typescript": true, "srcDir": "src", "utilsPath": "./src/lib/askai", "componentsPath": "./src/components/askai" }
src/lib/askai.ts), extending it is a normal code edit — no plugin API needed:123456789// In src/lib/askai.ts export const services = { // ... existing services myai: { name: 'My AI', url: 'https://myai.com', buildUrl: (prompt) => `https://myai.com/chat?q=${encodeURIComponent(prompt)}`, }, };
1234567891011121314151617181920212223242526272829303132333435# askai — agent integration instructions Add one-click "Ask AI" actions to this web app using @raptrx/askai (npm). It is shadcn-style: the CLI copies editable source files into the project; nothing is installed as a runtime dependency. Follow these rules exactly: 1. Scaffold with: npx @raptrx/askai init (writes askai.json plus src/lib/askai.ts — answer the prompts for default goal, AI tools to include, and components path). 2. Add the components needed: npx @raptrx/askai add button # AskAIButton npx @raptrx/askai add link # AskAILink (SSR-friendly anchor) npx @raptrx/askai add dropdown # AskAIDropdown (multi-service) 3. Use them with three props: `service` (target chat id), `goal` (the instruction, e.g. "Explain this code"), and `content` (the text/code sent to the AI). AskAIDropdown takes `services` (an array of ids) instead of `service`. 4. Valid service ids: chatgpt, claude, gemini, grok, perplexity, deepseek, mistral, copilot, kagi, google. Do not invent ids. 5. Outside React, import from the copied lib: buildPromptUrl(serviceId, goal, content) returns the deep-link URL; openInAI(serviceId, goal, content) opens it directly. 6. Never add API keys or a backend — askai builds deep links that open the user's own AI chat account; there is nothing to provision. 7. To add or remove AI services, edit the registry in src/lib/askai.ts directly (it lives in the project, not in node_modules). Each entry needs a name, url, and buildUrl(prompt) function. 8. Content is auto-truncated per service (maxLength) to avoid 414 URI Too Long, and code is wrapped in markdown code blocks — do not pre-truncate or pre-wrap. 9. If the CLI cannot run interactively, copy the core lib and components from https://github.com/aliarain/askai manually — the result is identical. Docs: https://docs.aliarain.com/askai
llms.txt index.