Skip to content

Autocomplete for your chatbot.

Add inline suggestions to your existing textbox. Tab accepts one word.

01

Quickstart

Copy these instructions into your coding agent. See the autocomplete skill and supported integrations.

Setup instructions

The prompt guides your agent through the CLI, secure connection and verification in your app.

Preview instructions
Integrate HyperWrite Autocomplete into this app's existing chatbot message box: gray inline suggestions for the user's unfinished message, with Tab accepting one word. Preserve the interface, login and send behavior; this does not generate assistant replies.

Read https://autocomplete.dev/skills/add-autocomplete/SKILL.md and its reference https://autocomplete.dev/agents/autocomplete.md, plus https://autocomplete.dev/docs and https://autocomplete.dev/openapi.json. Public skill source: https://github.com/OthersideAI/autocomplete-skills. No private repository access is needed. Adapt to this app's stack and package manager; keep the integration small.

1. Inspect the actual codebase, composer, verified login flow, dev-server configuration and deployment plan. Use localhost, production directly, or both as appropriate; starting locally is common, not mandatory. Determine the actual browser frontend origin from that evidence and ask the owner only if it remains unclear. Do not invent a website or assume the app uses a default port. React/React DOM 18.2 or 19 supports one native or ref-forwarding controlled textarea, including autosizing textareas; use @hyperwrite/autocomplete/dom for non-React native textareas. For rich-text/contenteditable, explain the compatibility gap before changing anything; do not replace the editor or invent support. Desktop English is the starting point; mobile and other languages need explicit testing.

2. In the target app directory, run npx @hyperwrite/autocomplete-cli init --json (Node.js 22+, Git, macOS/Linux/WSL). This installs @hyperwrite/autocomplete and the integration skill; it does not wire the app. Follow its structured remaining steps. For a monorepo, use the workspace package manager to install the SDK and init --skip-install. To install just the skill for a supported coding agent, use npx skills add OthersideAI/autocomplete-skills --skill add-autocomplete (Node.js 22.20+). Installing the skill teaches the workflow; it does not install the SDK or complete the integration.

3. Reuse an existing private backend key if configured. Otherwise, run npx @hyperwrite/autocomplete-cli connect --json and keep it running while the owner opens its approval link, compares the code/fingerprint and approves. The owner's browser may be on a different computer; the installer saves the key privately. Only business administrators use https://autocomplete.dev/console and Supabase; app end users keep their existing login. After verified sign-in, a new account automatically gets a personal project with no production website required initially. The normal Overview, API keys, and Origins & settings remain available. New workspaces include http://localhost:3000 and http://localhost:5173 by default. Owners can rename a personal project in settings and add exact HTTPS production origins when needed, using the same server-only key. Existing owners retain their project settings; inspect the saved origins and preserve them when adding entries. The owner must still approve the installer connection. New accounts receive $100 in nonexpiring credits, with no card. The introductory rate is $1 per million aggregate generated output tokens across all candidates, with input included. Use the owner's confirmed console balance; never invent or add referral attribution. Keep existing customer terms. Use actual origins from the app configuration; ask the owner only if they remain unclear.

If approval is unavailable or the owner already has a key, have them configure AUTOCOMPLETE_API_KEY privately in the server environment or a protected, gitignored backend env file. Never request keys in chat, print them, put them in command arguments, commit them or expose them to browsers/public env variables. Use placeholders in .env.example. The CLI defaults to .env.local; choose init --backend-env-file backend/.env.local for a separate backend and follow the skill's file-safety requirements. Set AUTOCOMPLETE_WEBSITE_ORIGIN per environment to the actual approved browser origin: scheme, hostname and port when needed, with no path, trailing slash, query, fragment or wildcard. Public origins require HTTPS; HTTP is allowed only for explicitly configured, supported localhost origins. Different ports, localhost vs 127.0.0.1, and apex vs www are distinct; approval of one does not authorize another. Saving an origin only authorizes SDK use there; the backend route and composer integration are still required. Explicitly load the backend env and configure hosting secrets privately; a local file does not configure production. Continue independent implementation if access is missing and list blockers.

4. Add POST /api/autocomplete-session using the app's verified server-side login, eligibility, CSRF and rate limits. Derive a stable opaque user ID from the authenticated internal ID (for example SHA-256), never an email or request JSON. Validate the browser's exact Origin against server configuration. Call POST https://autocomplete.dev/v1/browser-sessions with the server bearer key and {"user_id":"<opaque ID>","origin":"<configured origin>"}; create fresh headers, never forward browser Origin, cookies or Authorization. Use bounded timeouts, no redirects and safe errors. Validate the response and return only {token, expires_at, expires_in} with Cache-Control: no-store; expiry is Unix seconds and remaining seconds calculated on the server, accounting for transit time. Never invent login or expose an anonymous token endpoint.

5. Follow the skill's React or DOM recipe in the real composer. Use a stable createAutocompleteClient with baseUrl https://autocomplete.dev; getSession uses the app's authenticated/CSRF-aware helper. The SDK handles direct browser predictions and token renewal. For React, wrap only the existing textarea with Autocomplete, passing value, onValueChange, messages, contextKey and getSuggestions={client.getSuggestions} and getAvailability={client.getAvailability}. Credit exhaustion pauses new generations while typing and sending stay available; the SDK uses bounded availability checks to resume after a reward. Keep onChange for typing and onValueChange for accepted suggestions on the same draft. Preserve styling, refs, keyboard handlers, autosizing, attachments and voice controls; keep buttons outside the wrapper. Pass recent completed {role, content} turns, with the draft only in value. Change contextKey for user/chat changes, keep a client per user/composer, warm sessions only when eligible, and resetSession() on cleanup/logout (not dispose() in React StrictMode cleanup). Clear/unmount the draft on account changes; pause with enabled={false} when needed. Never persist drafts, history, predictions, tokens or keys in logs, traces or storage.

6. Run npx @hyperwrite/autocomplete-cli doctor --json and relevant build/typechecks plus deterministic integration tests. Doctor checks local preparation, not app correctness. Verify signed-out rejection, signed-in sessions, no key in browser bundles, and typing/sending through timeout, 429 and empty-result cases. With credentials and an approved origin in each selected local/production environment, verify the real app's session route returns 200 and browser predictions call /v1/autocomplete directly. Using synthetic text in a new conversation, type a word followed by a space (for example, Hello ). SDK 0.5.6 has no extra first-message character minimum. Confirm visible gray text and one-word Tab acceptance, existing controls, composition/undo and user/chat switching. Empty suggestions are valid but do not prove a visible integration. Real API checks consume the project's allowance. Separate mocked tests from real checks and report anything unverified.

Finish with changed files, configuration, checks and blockers. Leave a reviewable diff; do not deploy automatically or claim a working feature from installation alone.

Use CLI 0.1.4+ optional setup reporting: after inspecting this app, run `npx @hyperwrite/autocomplete-cli assess --fit <0-10> --confidence <low|medium|high> --summary "<short safe rationale>" --json`. Follow the skill rubric. Report actual backend-route-added and composer-connected completion using `progress`; report a supported blocked category if stopped. Never include code, user content, keys, addresses or raw logs. Respect disabled reporting and continue if it is unavailable. These reports are agent judgments/checks, not proof of a working integration.

You can also install the public integration skill with npx skills add OthersideAI/autocomplete-skills --skill add-autocomplete (Node.js 22.20+). The skill teaches a supported coding agent the workflow; npx @hyperwrite/autocomplete-cli init --json installs the SDK (Node.js 22+).

Need an API key? Get one in the console. Keep it on your server, never in chat.

Use React 18 or 19 and an existing controlled textarea. You’ll add a small session route to your backend, then wrap your input.

1 Install the SDK

Install the package in your frontend project. Sign in to the console; after verified sign-in, a new account automatically gets a personal project. No production website is required initially. Use the normal Overview, API keys, and Origins & settings to manage it and generate a server-only API key. You can rename your personal project in settings; existing project owners keep their settings.

Terminal
npm install @hyperwrite/autocomplete

Includes TypeScript definitions. React and React DOM 18.2 or 19 are required for the React integration; the JavaScript core does not require React.

2 Configure your backend

Inspect your app’s codebase, dev-server configuration and deployment plan to choose localhost, production directly, or both. Starting locally is common, not mandatory. If an agent is integrating for you, it should ask for the frontend origin only if it remains unclear after that inspection. Set these environment variables in your backend’s environment, using your server-only API key and the actual approved frontend origin for each environment.

Server environment · keep private
AUTOCOMPLETE_API_KEY=YOUR_API_KEY
AUTOCOMPLETE_WEBSITE_ORIGIN=https://chat.example.com

The example uses a production placeholder; replace it with your actual approved frontend origin. An origin includes the exact scheme and hostname, plus a port when needed, with no path, trailing slash, query, fragment or wildcard. Public origins require HTTPS; HTTP is allowed only for explicitly configured, supported localhost origins. New workspaces include http://localhost:3000 and http://localhost:5173 by default, using the same server-only API key. Check your project’s saved origins, including the actual dev-server port. Add exact HTTPS production origins when needed in Origins & settings in the console, preserving existing entries. Different ports, localhost versus 127.0.0.1, and apex versus www hosts are distinct; approval of one does not authorize another.

Saving an origin only authorizes SDK use at that origin. You still need the backend session route and the SDK integrated into your app’s composer.

For local development, load these values through your backend’s environment configuration. If you use a .env file, keep it gitignored. When deploying, configure the backend’s hosting secrets separately; a local file does not configure production. Keep the API key out of frontend environment variables and source control.

3 Add your session route

Choose your backend language. Your frontend will call /api/autocomplete-session. This route calls https://autocomplete.dev/v1/browser-sessions, which we already host. Both examples work with the React code in the next step.

Add this route to your existing Python 3.11+ / FastAPI backend, where app is your FastAPI app. Install the HTTP client in your backend environment with pip install httpx.

Connect your existing login here

The marked request.state.user_id lookup must read the user from your verified server-side login. FastAPI and our SDK do not populate this value. Adapt that line to your auth middleware or dependency; never fill it from request JSON. Keep your app’s authentication, CSRF and rate-limit checks on this route, and apply any plan or experiment eligibility checks.

Python / FastAPI · your backend
import asyncio
import hashlib
import os
import time

import httpx
from fastapi import Request
from fastapi.responses import JSONResponse

# Add to your existing FastAPI app. Load these on the server only.
api_key = os.environ.get("AUTOCOMPLETE_API_KEY")
website_origin = os.environ.get("AUTOCOMPLETE_WEBSITE_ORIGIN")
if not api_key or not website_origin:
    raise RuntimeError("Set AUTOCOMPLETE_API_KEY and AUTOCOMPLETE_WEBSITE_ORIGIN")


def session_response(body, status=200):
    return JSONResponse(body, status_code=status, headers={"Cache-Control": "no-store"})


# Keep your existing login, CSRF and rate-limit middleware on this route.
@app.post("/api/autocomplete-session")
async def autocomplete_session(request: Request):
    # CONNECT YOUR AUTH: this value must come from your verified login.
    # Adapt this line to your auth library's stable internal user ID.
    user_id = getattr(request.state, "user_id", None)
    if user_id is None or user_id == "":
        return session_response({"error": "sign_in_required"}, 401)
    # Apply any plan or experiment eligibility checks here as well.
    if request.headers.get("origin") != website_origin:
        return session_response({"error": "origin_not_allowed"}, 403)

    # Map your internal ID (not an email) to an API-compatible opaque ID.
    opaque_user_id = hashlib.sha256(str(user_id).encode("utf-8")).hexdigest()
    try:
        started_at = time.monotonic()
        async with asyncio.timeout(5), httpx.AsyncClient(timeout=5, follow_redirects=False) as client:
            response = await client.post(
                "https://autocomplete.dev/v1/browser-sessions",
                headers={"Authorization": f"Bearer {api_key}", "Content-Type": "application/json"},
                json={"user_id": opaque_user_id, "origin": website_origin},
            )
            if not response.is_success:
                return session_response({
                    "error": "autocomplete_unavailable", "upstream_status": response.status_code,
                }, 429 if response.status_code == 429 else 502)
            session = response.json()
            token, expires_at = session.get("token"), session.get("expires_at")
            if (not isinstance(token, str) or not token or type(expires_at) is not int
                    or not 0 < expires_at <= 9_007_199_254_740_991):
                return session_response({"error": "invalid_session_response"}, 502)
            if "expires_in" in session:
                expires_in = session["expires_in"]
                if type(expires_in) not in (int, float) or not 0 <= expires_in <= 900:
                    return session_response({"error": "invalid_session_response"}, 502)
                expires_in -= max(0, time.monotonic() - started_at)
            else:  # Compatibility with older APIs; uses only the server's clock.
                expires_in = min(900, expires_at - time.time())
            if expires_in <= 0:
                return session_response({"error": "invalid_session_response"}, 502)
            return session_response({"token": token, "expires_at": expires_at, "expires_in": expires_in})
    except (httpx.HTTPError, TimeoutError, ValueError, AttributeError):
        return session_response({"error": "autocomplete_unavailable"}, 503)

If you use Uvicorn locally, uvicorn server:app --env-file .env loads your environment file when python-dotenv is installed (included in uvicorn[standard]). Replace server:app with your existing app’s module and name.

Add this route to your existing Node 22+ / Express backend, where app is your Express app.

Connect your existing login here

The marked req.user?.id line must read the user from your verified server-side login. Express and our SDK do not create req.user for you. Adapt that line to your auth library; never fill it from request JSON. Register this route after your app’s authentication, CSRF and rate-limit middleware, and apply any plan or experiment eligibility checks.

Node / Express · your backend
import { createHash } from 'node:crypto';

// Add to your existing Express app. Load these on the server only.
const apiKey = process.env.AUTOCOMPLETE_API_KEY;
const websiteOrigin = process.env.AUTOCOMPLETE_WEBSITE_ORIGIN;
if (!apiKey || !websiteOrigin) {
  throw new Error('Set AUTOCOMPLETE_API_KEY and AUTOCOMPLETE_WEBSITE_ORIGIN');
}

// Register after your existing login, CSRF and rate-limit middleware.
app.post('/api/autocomplete-session', async (req, res) => {
  res.set('Cache-Control', 'no-store');

  // CONNECT YOUR AUTH: req.user must come from your verified login.
  // Adapt this line to your auth library's stable internal user ID.
  const userId = req.user?.id;
  if (userId == null || userId === '') {
    return res.status(401).json({ error: 'sign_in_required' });
  }
  // Apply any plan or experiment eligibility checks here as well.
  if (req.get('Origin') !== websiteOrigin) {
    return res.status(403).json({ error: 'origin_not_allowed' });
  }

  // Map your internal ID (not an email) to an API-compatible opaque ID.
  const opaqueUserId = createHash('sha256').update(String(userId)).digest('hex');
  try {
    const startedAt = performance.now();
    const response = await fetch('https://autocomplete.dev/v1/browser-sessions', {
      method: 'POST',
      headers: {
        Authorization: `Bearer ${apiKey}`,
        'Content-Type': 'application/json',
      },
      body: JSON.stringify({ user_id: opaqueUserId, origin: websiteOrigin }),
      signal: AbortSignal.timeout(5000),
      redirect: 'error',
    });
    if (!response.ok) {
      return res.status(response.status === 429 ? 429 : 502).json({
        error: 'autocomplete_unavailable', upstream_status: response.status,
      });
    }
    const session = await response.json();
    const { token, expires_at } = session;
    if (typeof token !== 'string' || !token ||
        !Number.isSafeInteger(expires_at) || expires_at <= 0) {
      return res.status(502).json({ error: 'invalid_session_response' });
    }
    let expires_in;
    if (Object.hasOwn(session, 'expires_in')) {
      expires_in = session.expires_in;
      if (!Number.isFinite(expires_in) || expires_in < 0 || expires_in > 900) {
        return res.status(502).json({ error: 'invalid_session_response' });
      }
      expires_in -= Math.max(0, performance.now() - startedAt) / 1000;
    } else { // Compatibility with older APIs; uses only the server's clock.
      expires_in = Math.min(900, expires_at - Date.now() / 1000);
    }
    if (expires_in <= 0) return res.status(502).json({ error: 'invalid_session_response' });
    return res.json({ token, expires_at, expires_in });
  } catch {
    return res.status(503).json({ error: 'autocomplete_unavailable' });
  }
});

For a local .env file, run node --env-file=.env server.mjs, using your server’s entry filename.

Use a stable internal user ID unique across your project, not an email. The example hashes it into a consistent API-compatible ID, including when your login provider uses characters such as |.

This example serves /api/autocomplete-session on the same origin as your frontend. If your local frontend and backend use different ports, proxy /api to your backend in your dev server. AUTOCOMPLETE_WEBSITE_ORIGIN is the website address in the browser, not your backend’s address.

4 Connect your existing textbox

In the React example below, getSession calls the route you just added. The browser sends its existing login credentials; the API key stays on your server. The route returns a browser token, and the SDK uses it for prediction requests directly to Autocomplete.

The client handles API requests and session renewal. Autocomplete handles the suggestions, matching queue, and keyboard behavior. Initialize the client once per user/composer.

Composer.tsx
import { useEffect, useMemo, useState } from 'react';
import {
  createAutocompleteClient,
  type ChatMessage,
} from '@hyperwrite/autocomplete';
import { Autocomplete } from '@hyperwrite/autocomplete/react';

type Props = {
  userId: string;
  conversationId: string;
  messages: ChatMessage[];
  onSend: (message: string) => void;
};

export function Composer({
  userId, conversationId, messages, onSend,
}: Props) {
  const [draft, setDraft] = useState('');
  const client = useMemo(() => createAutocompleteClient({
    baseUrl: 'https://autocomplete.dev',
    async getSession() {
      // Calls YOUR backend route from step 3. No API key here.
      // Use your existing auth/CSRF request helper if your app needs one.
      const response = await fetch('/api/autocomplete-session', {
        method: 'POST',
        credentials: 'same-origin',
        cache: 'no-store',
        signal: AbortSignal.timeout(6000),
      });
      if (!response.ok) throw new Error('Session unavailable');
      return response.json();
    },
  }), [userId]);

  useEffect(() => {
    void client.warmSession().catch(() => {});
    return () => client.resetSession();
  }, [client]);

  return (
    <div>
      <label htmlFor="message">Your message</label>
      <Autocomplete
        value={draft}
        onValueChange={setDraft}
        contextKey={`${userId}:${conversationId}`}
        messages={messages}
        getSuggestions={client.getSuggestions}
      getAvailability={client.getAvailability}
      >
        <textarea
          id="message"
          value={draft}
          onChange={event => setDraft(event.target.value)}
        />
      </Autocomplete>
      <button
        type="button"
        disabled={!draft.trim()}
        onClick={() => { onSend(draft); setDraft(''); }}
      >
        Send
      </button>
    </div>
  );
}

Pass messages as recent { role: 'user' | 'assistant', content: string } turns. Keep the unfinished draft in value. Change contextKey when the user or conversation changes; the SDK clears incompatible suggestions.

Mount this example with key={`${userId}:${conversationId}`} on Composer so switching users or chats also resets its local draft. contextKey resets suggestions, not your application’s draft state.

Keep normal typing in your existing handler. The textarea’s onChange handles typing. onValueChange commits accepted suggestions only. Give both the wrapper and textarea the same controlled value.

5 Check the connection

  1. Open your app on the approved origin and sign in with a user eligible for autocomplete.
  2. Open your browser’s Network panel. When the composer mounts, POST /api/autocomplete-session should return 200 with the two fields below.
  3. Focus the textbox. In a new conversation, type a word followed by a space (for example, Hello ). Look for a request to https://autocomplete.dev/v1/autocomplete. When a gray suggestion appears, press Tab to accept one word.
Example session response · 200 OK
{
  "token": "GENERATED_BROWSER_TOKEN",
  "expires_at": 1900000600,
  "expires_in": 600
}

Illustrative response. The actual browser token and expiry are generated for each session; expires_at is Unix seconds and expires_in is remaining seconds calculated on the server. Sessions last 10 minutes by default, and the SDK handles renewal.

Your API key should appear only in your backend’s request to our API. The frontend receives only the browser token. An autocomplete response with no candidates is normal; the user can keep typing.

Common setup errors

Responses from your /api/autocomplete-session route in this example
ResponseWhat to check
401 · sign_in_requiredSign in and connect the marked user ID line to your verified login. Make sure your frontend sends the cookie or authorization headers your app expects.
403 · origin_not_allowedThe browser’s origin must exactly match AUTOCOMPLETE_WEBSITE_ORIGIN. Check the scheme and port; omit the trailing slash.
502 · upstream_status: 401The API key is incorrect or revoked. Check the server environment value. A missing environment variable stops the example at startup.
502 · upstream_status: 403Check the configured website origin in the console. Keep the example’s upstream headers; do not forward the browser’s Origin header with the API key.
502 · upstream_status: 422Check the upstream request format and origin. Use the example’s stable user ID mapping; don’t send an email or raw request-body identity.
402Token credits are exhausted. Pause new generations; the owner can request more credits in the console. Typing and sending keep working.
429A rate limit or pending credit reservation was reached. Wait before trying again; don’t retry in a tight loop.
Other 502 or 503The upstream service failed, timed out or returned an invalid response. Check connectivity and contact us if it persists. Normal typing should keep working.

If the session request returns 404 or an HTML page, check that the route is registered and your frontend’s /api proxy reaches it. Your existing auth middleware should return JSON errors for this route instead of redirecting to a login page.

02

Authentication

Your API key is the server-only secret you generate in the console. It stays on your backend. Your frontend uses a short-lived browser token to request predictions directly from Autocomplete.

Session setupBrowserYour backendAutocomplete API
While typingBrowserAutocomplete API

Your backend is involved at session creation and renewal, not on every keystroke. A serverless function works too.

The backend’s request

HTTP · server to server
POST https://autocomplete.dev/v1/browser-sessions
Authorization: Bearer YOUR_API_KEY
Content-Type: application/json

{
  "user_id": "opaque-user-123",
  "origin": "https://chat.example.com"
}

Return token, expires_at, and expires_in to your browser, with Cache-Control: no-store. expires_at is Unix seconds; calculate remaining seconds expires_in on the server so browser clock differences do not discard valid sessions. Sessions last 10 minutes by default. The SDK keeps the token in memory and handles renewal.

  • Authenticate the signed-in user and check whether they’re eligible for autocomplete.
  • Derive a stable, opaque user_id from that session. Don’t trust an ID supplied by the browser or use an email address.
  • Use an approved, configured origin such as https://chat.example.com. Origins must match exactly, including any non-default port, with no path or wildcard.
  • Rate-limit your route and retain your app’s normal authentication and CSRF protection.

Generate and revoke API keys in the console. Copy a new key when it is shown and save it in your backend’s secret settings; you cannot reveal it again. Configure exact HTTPS production origins there, with no path, trailing slash, or wildcard. New workspaces also include http://localhost:3000 and http://localhost:5173 for local development with the same server-only key. Existing manually onboarded projects stay managed through our team; signing in does not claim an existing project. Never include your API key in frontend code, browser storage, or a public repository.

03

Your textbox stays yours

Autocomplete accepts one controlled textarea child. It keeps your styles, ref, and event handlers, and adds no layout wrapper. Put labels, send buttons, file uploads, and voice controls outside the component.

Using an autosizing textarea? Keep it. Custom components must forward their ref and standard textarea props to the native element. Voice input should update the same React state, using your existing ref for caret positioning.

Your keyboard handler runs first. Calling preventDefault() takes precedence over the SDK. Enter remains your app’s Send or newline behavior.

Keyboard behavior when a suggestion is visible
KeyAction
TabAccept the next word.
→ Right ArrowAccept the remaining suggestion.
Alt / Option + ↑ / ↓Cycle through alternatives.
EscDismiss the suggestion.
Shift + TabMove focus normally.

Tab without a suggestion and plain Up/Down retain their normal behavior. The running queue keeps compatible suggestions, so typing or backspacing can reveal a match without waiting for another request.

Supported in this preview

Desktop native and ref-forwarding textareas, including autosizing, with suggestions at the end of the draft. Contenteditable and rich-text editors need additional support. Mobile keyboards, broad multilingual word acceptance, and all browser/accessibility combinations are not yet qualified. Tell us about your editor and we’ll help evaluate it.

Give the input an accessible label. The React component adds keyboard instructions and a suggestion-availability announcement. Suggestions pause during composition, selection, or when the caret moves away from the end.

04

A few useful options

Start with the defaults. Add these props to Autocomplete when your app needs them.

Give users an easy way to turn suggestions off, and connect that preference to enabled. They can keep typing normally when autocomplete is off.

Optional Autocomplete component props
PropWhat it does
enabledSet false to suspend autocomplete, for example while recording voice input or sending a message. Disabled and read-only textareas also suspend it.
systemPromptOptional writing guidance for the user’s message, such as tone or domain. Up to 2,000 Unicode characters. Empty by default.
additionalContextRelevant reference text or document excerpts, most useful first. Up to 12,000 Unicode characters; context may be shortened to fit. Empty by default.
themeAdjust suggestion color, opacity, tabBorderColor, and tabBackgroundColor. By default, the overlay follows your textarea’s typography and text color.
timeBetweenAutocompleteMsOptional minimum gap between request starts; 0 ms by default. The API enforces its own per-user pacing independently.

Fresh suggestions are requested after a typed space or accepted word, while matching suggestions remain available. Requests start immediately by default, with no SDK concurrency cap. The API may reject requests inside its per-user cooldown; rejected requests are not retried automatically.

Reference context is text, not a file upload: URLs and filenames are not fetched. Pass relevant excerpts rather than entire documents. Changes to guidance or reference text clear pending work and incompatible suggestions automatically.

05

Ordinary localhost works

If you are working locally, your app can run at http://localhost:3000 or http://localhost:5173 and call the hosted HTTPS API. Use the actual approved dev-server origin; no local certificates are needed for HTTP localhost. You can integrate in an approved HTTPS production environment directly if that fits your app.

  1. Generate a server-only API key in the console.
  2. New workspaces include http://localhost:3000 and http://localhost:5173. Check your project’s saved origins if you have changed them.
  3. Configure your local backend session route with the same server-only key and the exact local frontend origin.
  4. Keep the client’s baseUrl set to https://autocomplete.dev.

localhost and 127.0.0.1 are different origins. Only configured HTTP localhost origins are allowed; public websites use HTTPS. Manage other localhost ports in the console.

06

The API, at a glance

The SDK takes care of request identifiers, correlation, suffix matching, and expiry. Use the HTTP reference if you’re building a custom client or checking an exact schema.

Candidates are suffixes to the exact requested prefix. Preserve whitespace: "Can you sum" + "marize this". An empty candidate list is a normal response.

Request limits

  • 32 KiB maximum JSON request body.
  • 4,000-character draft; up to 12 recent user/assistant messages, each up to 10,000 characters.
  • Up to 30 returned candidates, each up to 512 characters.

These are individual bounds, not amounts that fit together in one request. Combined body and model-context limits also apply. The SDK counts text limits in UTF-16 code units; HTTP string limits count Unicode characters. Oversized drafts are rejected rather than silently changed.

Errors shouldn’t interrupt typing

Common HTTP errors and how to handle them
StatusMeaning and handling
401Invalid or expired credentials. The SDK refreshes the session once.
403Origin or scope mismatch. Check your project’s approved origins and session setup.
409Duplicate request ID. Generate a new ID for each new request.
413 / 415 / 422Request size, content type, schema, or context-limit issue. Correct the request before retrying.
429A per-user, project, or shared request/concurrency limit was reached. The rejected request is not retried automatically. The client exposes Retry-After metadata; later user-triggered requests are not automatically delayed.
503 / 504Service unavailable or inference timeout. Keep typing available; don’t automatically replay the request.

The API returns { "error": { "code": "…", "message": "…" } }. The SDK does not replay inference after network failures or timeouts.

Open HTTP reference View OpenAPI schema
07

Data handling

The API processes drafts, conversation text, writing guidance, and suggestions in memory. It does not persist this content in its application storage or production logs. The SDK keeps its suggestion queue and session credentials in memory, with no persistent browser storage or automatic interaction analytics.

Project configuration, key hashes, and content-free operational records are retained. Generation records contain your project, a project-scoped keyed hash of the user ID, request ID, timestamp, and limited operational metadata such as the number of suggestions returned. They contain no message or suggestion text, original user IDs, or IP addresses. These records measure API use, not whether suggestions were shown or accepted.

Content is sent to the configured inference provider to generate predictions; this description does not establish that provider’s retention policy. Contact us for current provider-handling details before a production rollout.

Keep drafts, credentials, and suggestions out of your own application logs and monitoring tools.

Let’s make it fit your chatbot

A real person, one email away.

Send us your framework and textbox setup. We’ll help with access and your first integration.

Contact our team