Echo

Introduction

Echo

Echo is billing infrastructure for AI applications that turns your OpenAI imports into revenue-generating user accounts across React, Next.js, Node.js, and CLI tools.

Why use Echo?

Building AI apps means handling payments, user auth, usage tracking, and API key management. Each user needs their own balance, every LLM call needs metering, and you're stuck building Stripe flows instead of features.

Echo standardizes AI billing like Clerk standardized auth. Drop in our SDK, set your markup percentage, and your existing OpenAI code instantly gets user accounts with usage-based billing. No payment processing, no surprise bills, no exposed API keys.

Result: Your users get one universal balance that works across all Echo-powered apps, creating network effects that grow your user base while you focus on building.

Starting Fresh

The quickest way to get started with Echo is to use the echo-start CLI tool, which scaffolds a new project with Echo already configured:

npx echo-start@latest --template next
yarn dlx echo-start@latest --template next
pnpx echo-start@latest --template next
bunx echo-start@latest --template next

This will create a new Next.js app with Echo integration ready to go. For other templates and frameworks, check out our templates section.

Example Integration

Here's how you can add complete user management and LLM billing to your app:

import { EchoProvider, EchoTokens, useEchoModelProviders } from '@merit-systems/echo-react-sdk';
import { generateText } from 'ai';

function App() {
  return (
    <EchoProvider config={{ appId: 'your-app-id' }}>
      {/* Complete user management - handles auth, billing, sign-out */}
      <EchoTokens showAvatar={true} />
      
      <ChatComponent />
    </EchoProvider>
  );
}

function ChatComponent() {
  const { openai } = useEchoModelProviders();
  
  const handleGenerate = async () => {
    const { text } = await generateText({
      model: openai('gpt-5'),
      prompt: 'Hello world'
    });
    return text;
  };
  
  return <button onClick={handleGenerate}>Ask AI</button>;
}

export default App

Three integration patterns:

  • React SDK — OAuth2 + PKCE for secure client-side LLM calls
  • Next.js SDK — Server-side auth with automatic token management
  • TypeScript SDK — API keys for backends and CLI tools

The React and Next.js SDKs are opinionated wrappers around the TypeScript SDK, providing framework-specific patterns while the TypeScript SDK offers direct API access for maximum flexibility.

Templates

We provide a variety of ready-to-use templates to help you get started quickly with Echo:

Core Templates

  • Next.js — Full-stack Next.js app with Echo integration
  • React — Vite-powered React app with Echo SDK
  • Assistant UI — Full-featured chat UI with @assistant-ui/react

Feature-Specific Templates

  • Next.js Chat — Chat interface built with Next.js and Echo
  • Next.js Image Generation — Image generation app with Echo billing
  • Next.js Video — Video generation app with Echo integration
  • Next.js API Key — Server-side API key management template
  • React Chat — Chat interface for React apps
  • React Image — Image generation for React apps

All templates are available through echo-start or in the GitHub repository. Visit our templates documentation for detailed setup instructions.