Echo
TypeScript SDK

Resources

Platform operations - apps, balance, payments, users, models

Resources

The EchoClient provides access to platform resources through dedicated modules. Each resource handles a specific domain of Echo platform operations.

Apps Resource

Manage your Echo applications and retrieve app information.

const apps = await echo.apps.listEchoApps();
const app = await echo.apps.getEchoApp('app-id');
const appUrl = echo.apps.getAppUrl('app-id');

Methods

  • listEchoApps() - List all your Echo applications
  • getEchoApp(appId) - Get specific application details
  • getAppUrl(appId) - Generate application URL

Types

import type { EchoApp } from '@merit-systems/echo-typescript-sdk';

EchoApp

Prop

Type

Balance Resource

Check account balance and free tier usage across applications.

const balance = await echo.balance.getBalance();
const freeBalance = await echo.balance.getFreeBalance('app-id');

Methods

  • getBalance() - Get total account balance across all apps
  • getFreeBalance(echoAppId) - Get free tier balance for specific app

Types

import type {
  Balance,
  FreeBalance,
  UserSpendInfo,
} from '@merit-systems/echo-typescript-sdk';

Balance

Prop

Type

FreeBalance

Prop

Type

UserSpendInfo

Prop

Type

Payments Resource

Handle payment links and credit purchases through Stripe integration.

const paymentLink = await echo.payments.createPaymentLink({
  amount: 25,
  description: 'Echo Credits',
});

const paymentUrl = await echo.payments.getPaymentUrl(10, 'Quick Top-up');

Methods

  • createPaymentLink(request) - Create detailed payment link with options
  • getPaymentUrl(amount, description?, successUrl?) - Quick payment URL generation

Types

import type {
  CreatePaymentLinkRequest,
  CreatePaymentLinkResponse,
} from '@merit-systems/echo-typescript-sdk';

CreatePaymentLinkRequest

Prop

Type

CreatePaymentLinkResponse

Prop

Type

Models Resource

Get information about supported LLM models, pricing, and capabilities.

const chatModels = await echo.models.listSupportedChatModels();
const imageModels = await echo.models.listSupportedImageModels();

Methods

  • listSupportedChatModels() - Get all supported chat models with pricing and metadata
  • listSupportedImageModels() - Get all supported image models with pricing and metadata

Types

import type {
  SupportedModel,
  SupportedImageModel,
} from '@merit-systems/echo-typescript-sdk';

SupportedModel

Prop

Type

SupportedImageModel

Prop

Type

Users Resource

Manage user information and referral code registration.

const user = await echo.users.getUserInfo();
const referralResult = await echo.users.registerReferralCode(
  'app-id',
  'REFERRAL123'
);

Methods

  • getUserInfo() - Get current user information and spending data
  • registerReferralCode(echoAppId, code) - Register referral code for benefits

Types

import type {
  User,
  RegisterReferralCodeRequest,
  RegisterReferralCodeResponse,
} from '@merit-systems/echo-typescript-sdk';

User

Prop

Type

RegisterReferralCodeRequest

Prop

Type

RegisterReferralCodeResponse

Prop

Type

Example Usage

Complete Platform Operations

import { EchoClient } from '@merit-systems/echo-typescript-sdk';

const echo = new EchoClient({ apiKey: process.env.ECHO_API_KEY });

async function platformDemo() {
  // Check user and balance
  const user = await echo.users.getUserInfo();
  const balance = await echo.balance.getBalance();

  console.log(`User: ${user.email}, Balance: $${balance.balance}`);

  // Create payment link if balance is low
  if (balance.balance < 5) {
    const payment = await echo.payments.createPaymentLink({
      amount: 20,
      description: 'Account Top-up',
    });

    console.log(`Payment link: ${payment.url}`);
  }

  // List available models
  const chatModels = await echo.models.listSupportedChatModels();
  const imageModels = await echo.models.listSupportedImageModels();
  console.log(`Available chat models: ${chatModels.length}`);
  console.log(`Available image models: ${imageModels.length}`);

  // Get app information
  const apps = await echo.apps.listEchoApps();
  console.log(`Your apps: ${apps.length}`);
}