Skip to content

Authentication ​

Gommo Developer client

Official Gommo Developer TypeScript client — npm alias @ai-gateway/client. Calls Gommo public API (api.gommo.net, v2.api.gommo.net).

→ Gommo public API · Roadmap

Login ​

typescript
import { GommoClient } from '@ai-gateway/client';

const client = new GommoClient({ domain: process.env.GOMMO_DOMAIN ?? 'YOUR_REGISTRATION_DOMAIN' });

const { access_token } = await client.auth.login({
  email: '[email protected]',
  password: 'secret',
});
// Token is stored on client automatically

Pre-issued token ​

typescript
const client = new GommoClient({
  accessToken: process.env.GOMMO_ACCESS_TOKEN,
  domain: process.env.GOMMO_DOMAIN ?? 'YOUR_REGISTRATION_DOMAIN',
});

Login and me() call api.gommo.net; media jobs use v2.api.gommo.net automatically.

User profile + credits ​

typescript
const me = await client.auth.me(process.env.GOMMO_DOMAIN ?? 'YOUR_REGISTRATION_DOMAIN');
const credits = me.balancesInfo?.credits_ai;
const username = me.userInfo?.username ?? me.data?.username;

Use username for Billing topup when using self-hosted gateway billing.

Manual token update ​

typescript
client.setAccessToken(newToken);

Register (self-hosted gateway) ​

Merchant env (GOMMO_ACCESS_TOKEN, GOMMO_MANAGER_ID) must be set on the gateway. Registration domain is resolved server-side — do not send domain in the JSON body.

typescript
const client = new GommoClient({
  transport: 'gateway',
  gatewayBaseUrl: process.env.GATEWAY_URL,
});

const result = await client.auth.register({
  email: '[email protected]',
  password: 'secret12',
  phone: '0900000000',
  name: 'Optional name',
});

auth.register() is not available on transport: 'gommo' (public API register uses merchant form fields server-side).

→ Account settings — sign up

Change login password ​

Public API (form on api.gommo.net):

typescript
await client.auth.changePassword({
  currentPassword: process.env.CURRENT_PASSWORD!,
  newPassword: process.env.NEW_PASSWORD!,
  language: 'EN',
});

Self-hosted gateway (transport: 'gateway', gatewayBaseUrl):

typescript
const client = new GommoClient({
  transport: 'gateway',
  gatewayBaseUrl: process.env.GATEWAY_URL,
  accessToken: process.env.GOMMO_ACCESS_TOKEN,
});
await client.auth.changePassword({
  currentPassword: '…',
  newPassword: '…',
});

Not the same as AI project set_password. See Account settings — change password.

Transfer credits (P2P) ​

Public API (form on api.gommo.net):

typescript
await client.auth.transferCredits({
  username: 'recipient_username',
  value: 10_000,
  message: 'Transfer note',
  language: 'EN',
});

Self-hosted gateway (transport: 'gateway', Bearer session):

typescript
await client.auth.transferCredits({
  username: 'recipient_username',
  value: 10_000,
  message: 'Transfer note',
});

Upstream may return HTTP 200 with { error: 1, message: "…" } — check error / success on the returned envelope. Not merchant /admin/credits/send. See Account — transfer credits.

Transaction history (ledger) ​

Public API (form on api.gommo.net):

typescript
const ledger = await client.auth.listPaymentsHistory({
  limit: 500,
  time_start: 0,
  time_end: 0,
  language: 'EN',
});
// ledger.data — array of rows; sum plus/minus client-side

Self-hosted gateway (transport: 'gateway', Bearer session):

typescript
await client.auth.listPaymentsHistory({ limit: 500, source: 'sendBalances' });

Not /api/v2/usage-history. See Account — transaction history.

Session devices ​

Public API (form on api.gommo.net):

typescript
const sessions = await client.auth.listDevices({
  language: 'EN',
  current_device_id: deviceId,
  device_id: deviceId,
  device_name: 'Browser 1',
});
// sessions.data?.items — array of rows; sessions.data?.current_device_id

Self-hosted gateway:

typescript
await client.auth.registerDevice({ language: 'EN' });
await client.auth.renameDevice({ device_id: '…', device_name: 'Work laptop' });
await client.auth.disableDevice({ device_id: '…' });

See Account — session devices.

Support tickets ​

typescript
const tickets = await client.auth.listSupportTickets({ language: 'EN' });
// tickets.data — array of ticket summaries

const created = await client.auth.createSupportTicket({
  subject: 'Billing question',
  issue_type: 'bug',
  description: 'Steps to reproduce…',
});
// created.ticket_id_hash — use as ticket_id_base

const thread = await client.auth.getSupportTicketDetail({
  ticket_id_base: 'SUP-20260925-7022',
});

await client.auth.replySupportTicket({
  ticket_id_base: 'SUP-20260925-7022',
  content: 'Additional details…',
});

See Account — support tickets.

Partner program ​

typescript
const landing = await client.auth.getPartnerProgramStatus({ language: 'EN', lang: 'en' });
// landing.program, landing.application — prefer application?.status for pending review

await client.auth.applyPartnerProgram({
  bank_name: '…',
  account_name: '…',
  account_number: '…',
  contact: '…',
  email: '[email protected]',
  reason: '…',
  accept_rules: 1,
});

See Account — partner program.

Creator Rewards ​

typescript
const landing = await client.auth.getCreatorRewardsStatus({ language: 'EN' });
const pool = await client.auth.getCreatorRewardsPool({ language: 'EN' });

await client.auth.applyCreatorRewards({
  payout_pref: 'credit',
  contact: '…',
  email: '[email protected]',
  reason: '…',
  accept_rules: 1,
});

See Account — creator rewards.