Skip to content

Cài đặt ​

Gommo Developer client

Client Gommo Developer TypeScript — npm alias @ai-gateway/client. Gọi Gommo public API (api.gommo.net, v2.api.gommo.net).

→ Gommo public API · Roadmap

npm (khuyến nghị) ​

bash
npm install @ai-gateway/client

Package: @ai-gateway/client trên npm (hiện tại v1.0.0).

Pin version production:

bash
npm install @ai-gateway/[email protected]

Kiểm tra registry:

bash
npm view @ai-gateway/client version

Từ monorepo (contributors) ​

Khi develop repo gateway:

bash
npm run client:build
npm install ./packages/gateway-client

Environment ​

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

const client = new GommoClient({
  accessToken: process.env.GOMMO_ACCESS_TOKEN,
  domain: process.env.GOMMO_DOMAIN ?? 'YOUR_REGISTRATION_DOMAIN',
  // override tùy chọn:
  // v2BaseUrl: process.env.GOMMO_V2_BASE_URL ?? 'https://v2.api.gommo.net',
  // authBaseUrl: process.env.GOMMO_AUTH_BASE_URL ?? 'https://api.gommo.net',
});
OptionMặc địnhMô tả
v2BaseUrlhttps://v2.api.gommo.netModels, jobs, upload
authBaseUrlhttps://api.gommo.netLogin, me, chat, audio
domain<registration-domain>Domain đăng ký Gommo
projectIddefaultGommo project id
accessToken—Bearer token
fetchglobalThis.fetchCustom fetch (Node/Bun/Deno)

Self-host (operator) ​

Chỉ khi deploy repo — xem Deploy → Self-host nâng cao. SDK transport: 'gateway' dùng cho dev/portal, không phải contract Gommo public.

Verify ​

typescript
// Khuyến nghị — kiểm tra token + domain đăng ký:
const me = await client.auth.me();
console.log(me.balancesInfo?.credits_ai);

// Chỉ mode Gommo: ok giả lập (không validate token):
const health = await client.health();
console.log(health.data?.ok);