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).
npm (khuyến nghị)
bash
npm install @ai-gateway/clientPackage: @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 versionTừ monorepo (contributors)
Khi develop repo gateway:
bash
npm run client:build
npm install ./packages/gateway-clientEnvironment
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',
});| Option | Mặc định | Mô tả |
|---|---|---|
v2BaseUrl | https://v2.api.gommo.net | Models, jobs, upload |
authBaseUrl | https://api.gommo.net | Login, me, chat, audio |
domain | <registration-domain> | Domain đăng ký Gommo |
projectId | default | Gommo project id |
accessToken | — | Bearer token |
fetch | globalThis.fetch | Custom 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);