AI
Pass

How to Build an AI Tone Rewriter with AI Pass SDK

How to Build an AI Tone Rewriter with AI Pass SDK

In this tutorial, you'll build a practical AI tool that rewrites text in different tones — professional, friendly, casual, formal, or persuasive. It's a useful app with broad appeal, and you earn 50% commission on every API call your users make.

What You'll Build

A web app where users:

  1. Paste their text
  2. Select a target tone
  3. Get the text rewritten instantly

Step 1: Create Your AI Pass Account

  1. Go to aipass.one and sign up
  2. Verify your email (required for payouts)
  3. Open the Developer Dashboard

Step 2: Create an OAuth2 Client

  1. In the Developer Dashboard, go to OAuth2 Clients
  2. Click Create Client
  3. Copy your Client ID (looks like client_XXXX...)

Step 3: Build the App

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>AI Tone Rewriter</title>
  <link href="https://aipass.one/aipass-ui.css" rel="stylesheet">
  <style>
    body { font-family: sans-serif; max-width: 700px; margin: 40px auto; padding: 20px; }
    textarea { width: 100%; height: 120px; margin: 10px 0; font-size: 15px; }
    select, button { padding: 10px 20px; margin: 5px; font-size: 15px; }
    #output { margin-top: 20px; padding: 20px; background: #f0f4f8; border-radius: 8px; white-space: pre-wrap; display: none; }
  </style>
</head>
<body>
  <h1>✏️ AI Tone Rewriter</h1>
  <p>Paste your text, pick a tone, and get it rewritten.</p>
  <textarea id="input" placeholder="Paste your text here..."></textarea>
  <select id="tone">
    <option value="professional">Professional</option>
    <option value="friendly" selected>Friendly</option>
    <option value="casual">Casual</option>
    <option value="formal">Formal</option>
    <option value="persuasive">Persuasive</option>
    <option value="empathetic">Empathetic</option>
  </select>
  <button onclick="rewrite()">Rewrite</button>
  <div id="output"></div>

  <script src="https://aipass.one/aipass-sdk.js"></script>
  <script>
    AiPass.initialize({
      clientId: 'YOUR_CLIENT_ID',
      requireLogin: true,
      darkMode: true
    });

    async function rewrite() {
      const text = document.getElementById('input').value;
      const tone = document.getElementById('tone').value;
      const output = document.getElementById('output');
      output.style.display = 'block';
      output.textContent = 'Rewriting...';

      try {
        const r = await AiPass.generateCompletion({
          model: 'gpt-5-mini',
          temperature: 1,
          max_tokens: 16000,
          messages: [
            { role: 'system', content: `Rewrite the following text in a ${tone} tone. Keep the core meaning and key information. Output ONLY the rewritten text, nothing else.` },
            { role: 'user', content: text }
          ]
        });
        output.textContent = r.choices[0].message.content;
      } catch (e) {
        output.textContent = 'Error: ' + e.message;
      }
    }
  </script>
</body>
</html>

Step 4: Deploy

Option A: Self-host anywhere — GitHub Pages, Netlify, Vercel, your own server. The SDK handles auth and billing.

Option B: Publish on AI Pass — get a dedicated page with the embed (</>) button.

Key Details

  • requireLogin: true — shows auth screen automatically
  • temperature: 1 and max_tokens: 16000 — required for GPT-5 models via SDK
  • Users get $1 free credit on signup, then pay as you go
  • You earn 50% commission on every API call

Links