Capability / Chatbot input autocomplete
Add autocomplete
to your chatbot.
Add predictive text to your chat input: gray inline suggestions, often called ghost text, appear while users write. They press Tab to accept one word. Keep your existing chat composer, login and assistant model.
Send to your agent
Copy the setup prompt into your coding agent. It covers installation, secure connection and verification in your existing 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.Install the skill
npx skills add OthersideAI/autocomplete-skills --skill add-autocompleteRequires Node.js 22.20+. Choose a coding agent supported by the skills installer. The skill teaches your agent the integration workflow; it does not install the SDK or configure your application.
Install in the target application
npx @hyperwrite/autocomplete-cli init --jsonNode.js 22+, Git and macOS, Linux or WSL. The CLI installs the SDK and adds the integration skill to .agents/skills/add-autocomplete. Read its structured output for the remaining app-specific steps.
When this capability fits
- Goal
- Reduce typing and help users finish their own messages in a chatbot, writing assistant or support chat.
- Frontend
- React 18.2/19, Next.js client components and native DOM textareas. Existing textarea styling and send controls stay in place.
- Backend
- An authenticated session route in the app. Node/Express and Python/FastAPI examples are available; adapt the app's existing auth in Next.js.
- Behavior
- Gray inline suggestions, one-word Tab acceptance, dismissal and a matching suggestion queue. Normal typing continues during API failures.
- Boundaries
- Predicts the human user's draft. Assistant replies still come from your existing model. Rich-text/contenteditable editors need separate integration.
- Qualification
- Desktop English is the supported starting point. Mobile keyboards, multilingual word acceptance and rich-text editors need explicit testing.
From installation to a working composer
- Prepare the app. Run
init --jsonin its package directory. The CLI installs the SDK and copies the skill; it preserves existing app code. - Connect the developer's project. Reuse an existing private backend key when available. Run
npx @hyperwrite/autocomplete-cli connect. The owner signs in through the printed link, compares its code and fingerprint, and approves. Their browser can be on a different computer. The key is saved privately by the installer. - Wire verified app authentication. Add
POST /api/autocomplete-sessionto the app's backend, using its existing login, CSRF and rate-limit checks. The server key exchanges verified user identity for a short-lived browser token. - Integrate the existing textarea. Use the React wrapper or DOM adapter, pass recent conversation context, and reset sessions on logout/account changes. Preserve the existing send flow.
- Verify the feature. Run
npx @hyperwrite/autocomplete-cli doctor --json, then test the app itself: a signed-in user sees a suggestion, Tab accepts one word, and signed-out callers cannot obtain sessions.
The CLI prepares installation and connection. The coding agent adapts application authentication and editor wiring. A successful package install alone is not a working feature.
Credentials, origins and deployment
Keep AUTOCOMPLETE_API_KEY on the backend. Never put it in chat, frontend bundles, public environment variables or Git. The browser receives only a short-lived token. The installer does not receive the owner's account login.
No production website required initially. New personal projects include http://localhost:3000 and http://localhost:5173. When you are ready to deploy, add your exact HTTPS production origin in Origins & settings, using the same server-only key. Configure deployment secrets privately with the hosting provider; a local env file does not set production secrets.
Drafts and context are sent to the hosted service for predictions. See data handling for the application-storage and provider boundaries.
Token credits, no card required
New accounts receive 100 million output tokens. The rate is $1 per million generated output tokens; input is included. Count every generated candidate, including candidates discarded during ranking. For example, 20 candidates × 8 tokens = 160 tokens.
Credits never expire. There is no MAU eligibility gate for new credit accounts. Existing customer agreements remain unchanged.
At exhaustion, the host composer keeps typing and sending normally; suggestions pause. The owner manages credits in the dashboard. No card, automatic billing or checkout is required.
Resources for agents
- Canonical integration guide · MarkdownProtocol, environment, React example, Next.js adaptation and acceptance checks.
- Agent skill · SKILL.mdWhen to use the capability and a focused workflow.
- Downloadable skill archiveEntrypoint and reference, ready for a skill-compatible coding tool.
- Capability manifest · JSONVersioned package, resource URLs and supported integration surfaces.
- API schema · OpenAPIRuntime sessions, autocomplete and authenticated project management.
- Documentation discovery indexPublic entry points for this service.