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');
Get App
const app = await echo.apps.getEchoApp('app-id');
Parameters
Prop
Type
Response
Prop
Type
List Apps
const apps = await echo.apps.listEchoApps(params);
Parameters (optional)
Prop
Type
Response
Prop
Type
Get App URL
const appUrl = echo.apps.getAppUrl('app-id');
Response
https://echo.merit.systems/app/{app-id}
Types
import type {
GetAppsByIdResponse,
GetAppsByIdParams,
GetAppsResponse,
GetAppsQuery,
} from '@merit-systems/echo-typescript-sdk';
Methods
listEchoApps(query?)
- List all Echo apps with optional pagination and searchgetEchoApp(appId)
- Get a specific Echo app by IDgetAppUrl(appId)
- Get app URL for a specific Echo app
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');
Get Balance
Get the currently authenticated user's global echo balance.
const balance = await echo.balance.getBalance();
Response
Prop
Type
Get Free Balance
Get the currently authenticated user's free tier balance for your specific app.
const freeBalance = await echo.balance.getFreeBalance('app-id');
Parameters
Prop
Type
Response
Prop
Type
Types
import type {
GetBalanceResponse,
GetBalanceByIdFreeResponse,
GetBalanceByIdFreeParams,
} from '@merit-systems/echo-typescript-sdk';
Methods
getBalance()
- Get current balance for the authenticated user across all appsgetFreeBalance(echoAppId)
- Get free tier balance for a specific app
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');
Create Payment Link
Create a payment link for purchasing credits.
const paymentLink = await echo.payments.createPaymentLink({
amount: 25,
description: 'Echo Credits',
});
Request Body
Prop
Type
Response
Prop
Type
Get Payment URL
Get a payment URL for purchasing credits.
const paymentUrl = await echo.payments.getPaymentUrl(10, 'Quick Top-up');
Response
Returns a string
containing the payment URL.
Methods
createPaymentLink(request)
- Create detailed payment link with optionsgetPaymentUrl(amount, description?, successUrl?)
- Quick payment URL generation
Types
import type {
CreateStripePaymentLinkBody,
CreateStripePaymentLinkResponse,
GetBasePaymentLinkQuery,
GetBasePaymentLinkResponse,
} from '@merit-systems/echo-typescript-sdk';
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 metadatalistSupportedImageModels()
- 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'
);
Get User Info
Get the currently authenticated user's information.
const user = await echo.users.getUserInfo();
Response
Prop
Type
Register Referral Code
Register a referral code for benefits.
const referralResult = await echo.users.registerReferralCode(
'app-id',
'REFERRAL123'
);
Request Body
Prop
Type
Response
Prop
Type
Types
import type {
GetUserResponse,
CreateUserReferralBody,
CreateUserReferralResponse,
} from '@merit-systems/echo-typescript-sdk';
Methods
getUserInfo()
- Get current user information and spending dataregisterReferralCode(echoAppId, code)
- Register referral code for benefits
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}`);
}