SDK quickstart

Install a pinned SDK release, connect your backend and verify your composer.

1. Prepare your app

Create or reuse your company account and app in production onboarding. Review API and SDK pricing, then personally accept billing terms and add your card. Registration does not charge usage. For an evaluation without a card, explicitly choose the free sandbox.

Keep the runtime app key on your backend. Do not put it in a browser bundle, public environment variable or client-side request. The console verifies activation before offering installation.

2. Install the pinned release

SDK 0.4.0 is a GitHub prerelease. Download the package archive and its SHA-256 file from the official release, verify the checksum, and install the local archive in your frontend project:

shasum -a 256 -c clone-ai-tab-completion-0.4.0.tgz.sha256
npm install ./clone-ai-tab-completion-0.4.0.tgz

Use your platform's SHA-256 equivalent if shasum is unavailable. Install the same pinned archive in a separate backend project when using the server client. Keep the archive and lockfile in your dependency workflow; this guide does not rely on an npm registry publication. Read the release and upgrade instructions.

3. Add an authenticated proxy

Your product provides /api/clone/predict. Authenticate the product's user, derive their user_id from the server session, validate the request, and call Clone from your backend. Apply your product's rate and usage limits. Never trust a browser-provided user ID.

The SDK provides a server client:

import { CloneClient } from '@clone-ai/tab-completion/server';

const clone = new CloneClient({
  apiKey: process.env.CLONE_APP_KEY!,
  baseUrl: 'https://api.clone.is',
  requestTimeoutMs: 15000,
  maxConcurrentRequests: 16,
});

// Inside your authenticated server handler:
// body is the validated prediction request; signal cancels abandoned work.
const result = await clone.predict(authenticatedUser.id, body, { signal });

Keep one client per backend integration. Forward the result to the composer. The HTTP quickstart shows the complete request shape; the API reference covers identity and error handling. See the full integration guide for backend and editor wiring.

4. Connect your composer

Use your product's draft state and current conversation context. Define the transport once, outside the render function:

import { TabCompletionInput } from '@clone-ai/tab-completion/react';
import { createPredictionTransport } from '@clone-ai/tab-completion';

const transport = createPredictionTransport('/api/clone/predict');

// Inside your existing composer:
<TabCompletionInput
  value={draft}
  onValueChange={setDraft}
  context={context}
  transport={transport}
  presentation="instant"
  requestTimeoutMs={15000}
/>

This is an integration excerpt, not a standalone app. Keep your existing send handler independent of prediction requests. Tab inserts; your normal send control submits. Custom editors can use CompletionController or useTabCompletion instead of replacing the editor.

5. Choose your experience

An installation agent should inspect the framework, routes and authentication in your repository. Ask the customer only about unresolved product choices: suggestion triggers, instant or typewriter presentation, product context or optional Connect Clone, whether to expose Clone mode, its limits, and rollout controls. Preserve choices already supplied.

6. Verify before rollout

Use deterministic fixtures to check typing, IME composition, Tab insertion, edit-before-send, dismissal, old responses, timeout and API outage. Test in the actual customer composer. Typing and sending must remain usable when predictions fail.

After that, perform a bounded live check with an authorized app. Production predictions can be billable and require explicit PAYG consent. Report fixture behavior, live API behavior and customer-composer acceptance separately. Pin the working version and repeat these checks before upgrading. See reliability and limits.