File size: 5,082 Bytes
6417161
a231356
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6417161
a231356
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<!doctype html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="Generate browser-only OpenAI-compatible API examples for AI ROUTER.">
    <title>AI ROUTER API Migration Playground</title>
    <link rel="stylesheet" href="assets/styles.css">
  </head>
  <body>
    <main class="page-shell">
      <header class="hero">
        <div class="brand-row">
          <span class="brand-mark" aria-hidden="true">↗</span>
          <span class="brand-name">AI ROUTER</span>
          <span class="tag">Developer utility</span>
        </div>
        <div class="hero-grid">
          <div>
            <p class="eyebrow">OpenAI-compatible API migration</p>
            <h1>Build a safe request example before you change your code.</h1>
            <p class="hero-copy">
              Choose a model ID, add a test message, and get curl, Python, or
              Node.js code. The generator runs entirely in this browser.
            </p>
          </div>
          <aside class="privacy-card" aria-label="Privacy notice">
            <span class="privacy-icon" aria-hidden="true">⌘</span>
            <div>
              <strong>Your API key stays out of this Space.</strong>
              <p>Examples use an environment variable placeholder. This page does not make API calls.</p>
            </div>
          </aside>
        </div>
      </header>

      <section class="workspace" aria-label="API example generator">
        <div class="panel form-panel">
          <div class="section-heading">
            <p class="eyebrow">1. Configure an example</p>
            <h2>Request details</h2>
          </div>

          <label for="locale-select">Preferred website language</label>
          <select id="locale-select" name="locale"></select>

          <label for="base-url">Base URL</label>
          <input id="base-url" name="baseUrl" type="url" inputmode="url" value="https://api.ai-router.dev/v1" spellcheck="false">

          <label for="model-id">Model ID</label>
          <input id="model-id" name="model" type="text" placeholder="Choose a model shown in your dashboard" autocomplete="off" spellcheck="false">
          <p class="field-note">Use the model ID currently shown in your dashboard or returned by authenticated <code>/v1/models</code>.</p>

          <label for="message">Test message</label>
          <textarea id="message" name="message" rows="5" maxlength="1000">Write one concise sentence about OpenAI-compatible APIs.</textarea>

          <button id="generate" class="primary-button" type="button">Generate examples</button>
        </div>

        <div class="panel output-panel">
          <div class="output-heading">
            <div>
              <p class="eyebrow">2. Copy a starter</p>
              <h2>Generated code</h2>
            </div>
            <button id="copy-code" class="secondary-button" type="button">Copy code</button>
          </div>
          <div class="tabs" role="tablist" aria-label="Code language">
            <button class="tab active" type="button" role="tab" aria-selected="true" data-language="curl">curl</button>
            <button class="tab" type="button" role="tab" aria-selected="false" data-language="python">Python</button>
            <button class="tab" type="button" role="tab" aria-selected="false" data-language="node">Node.js</button>
          </div>
          <pre class="code-block"><code id="generated-code"></code></pre>
          <p class="output-note">Replace the placeholder environment variable locally. Never paste a live API key into a public Space, issue, or discussion.</p>
        </div>
      </section>

      <section class="language-section" aria-labelledby="language-heading">
        <div class="section-heading">
          <p class="eyebrow">Localized starting point</p>
          <h2 id="language-heading">Continue in your preferred language</h2>
        </div>
        <article id="locale-card" class="locale-card" aria-live="polite"></article>
      </section>

      <section class="guidance-grid" aria-label="Developer guidance">
        <article>
          <h2>Three-step migration</h2>
          <ol>
            <li>Create an account and review the current service rules.</li>
            <li>Create an API key and choose a model available to that key.</li>
            <li>Set your SDK base URL to the generated value and test a small request.</li>
          </ol>
        </article>
        <article>
          <h2>Keep integrations predictable</h2>
          <p>Model availability, plans, and pricing can change. Read the dashboard rather than hard-coding a model list or assuming a fixed plan.</p>
        </article>
        <article>
          <h2>Independent service</h2>
          <p>AI ROUTER is not an official OpenAI or Hugging Face service. “OpenAI-compatible” refers only to compatible request patterns.</p>
        </article>
      </section>
    </main>
    <script type="module" src="assets/app.js"></script>
  </body>
</html>