Skip to content

Instantly share code, notes, and snippets.

@JonDotsoy
Last active February 11, 2026 15:32
Show Gist options
  • Select an option

  • Save JonDotsoy/cbe24b7c757b7db851cfb55f0c30b1ba to your computer and use it in GitHub Desktop.

Select an option

Save JonDotsoy/cbe24b7c757b7db851cfb55f0c30b1ba to your computer and use it in GitHub Desktop.
This guide documents the standard URL schemes required to create links that open AI tools with a pre-filled prompt.

Deep Linking for Generative AI

This guide documents the standard URL schemes required to create links that open AI tools with a pre-filled prompt.

1. Core Concept: URL Encoding

Browsers cannot interpret spaces or special characters directly in a URL. To pass a prompt successfully, the text must be URL Encoded.

Key Substitutions:

  • Space ( ) %20
  • Comma (,) %2C
  • Question Mark (?) %3F
  • Double Quotes (") %22

Dev Note: Use standard functions like encodeURIComponent() in JavaScript to handle this automatically.


2. AI Endpoint Reference

Use these base URLs and query parameters to construct your links.

AI Platform Base URL Parameter
ChatGPT https://chatgpt.com/ ?q=
Claude https://claude.ai/new ?q=
Gemini https://gemini.google.com/app ?text=
Perplexity https://www.perplexity.ai/ ?q=
Grok (X) https://x.com/i/grok ?text=
Copilot https://copilot.microsoft.com/ ?q=

3. Implementation Patterns

A. JavaScript (Dynamic)

If you are generating links programmatically:

const rawPrompt = "Write a summary of the latest AI trends.";

// 1. Encode the text
const encoded = encodeURIComponent(rawPrompt);

// 2. Append to the specific base URL
const chatGPTLink = `https://chatgpt.com/?q=${encoded}`;
const geminiLink  = `https://gemini.google.com/app?text=${encoded}`;

B. HTML (Static)

When using these links in a website or email signature:

<a href="https://chatgpt.com/?q=Explain%20quantum%20computing" target="_blank" rel="noopener noreferrer">
  Ask ChatGPT
</a>

Best Practices:

  • target="_blank": Opens the AI in a new tab so the user doesn't leave your current page.
  • rel="noopener noreferrer": Essential for security and privacy when opening external links.

4. Practical Example

Original Text:

Create a marketing strategy for a coffee shop.

Encoded String: Create%20a%20marketing%20strategy%20for%20a%20coffee%20shop.

Final Ready-to-Use URLs:

  • ChatGPT: https://chatgpt.com/?q=Create%20a%20marketing%20strategy%20for%20a%20coffee%20shop.
  • Claude: https://claude.ai/new?q=Create%20a%20marketing%20strategy%20for%20a%20coffee%20shop.
  • Gemini: https://gemini.google.com/app?text=Create%20a%20marketing%20strategy%20for%20a%20coffee%20shop.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment