Skip to content

การติดตั้ง ​

Gommo Developer client

Client Gommo Developer TypeScript — npm alias @ai-gateway/client เรียก Gommo public API (api.gommo.net, v2.api.gommo.net)

→ Gommo public API · Roadmap

npm (แนะนำ) ​

bash
npm install @ai-gateway/client

Package: @ai-gateway/client บน npm (ปัจจุบัน v1.0.0)

Pin เวอร์ชันใน production:

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

ตรวจ registry:

bash
npm view @ai-gateway/client version

จาก monorepo นี้ (ผู้มีส่วนร่วม) ​

เมื่อพัฒนา gateway repo เอง:

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 (ไม่บังคับ):
  // v2BaseUrl: process.env.GOMMO_V2_BASE_URL ?? 'https://v2.api.gommo.net',
  // authBaseUrl: process.env.GOMMO_AUTH_BASE_URL ?? 'https://api.gommo.net',
});
Optionค่าเริ่มต้นคำอธิบาย
v2BaseUrlhttps://v2.api.gommo.netModels, jobs, upload
authBaseUrlhttps://api.gommo.netLogin, me, chat, audio
domain<registration-domain>Gommo registration domain
projectIddefaultGommo project id
accessToken—Bearer token
fetchglobalThis.fetchCustom fetch (Node/Bun/Deno)

Self-host (operator) ​

เมื่อ deploy repo เท่านั้น — ดู Deploy → Self-host ขั้นสูง SDK transport: 'gateway' สำหรับ dev/portal ไม่ใช่สัญญา Gommo public

Verify ​

typescript
// แนะนำ — ยืนยัน token + โดเมนลงทะเบียน:
const me = await client.auth.me();
console.log(me.balancesInfo?.credits_ai);

// โหมด Gommo เท่านั้น: ok สังเคราะห์ (ไม่ตรวจ token):
const health = await client.health();
console.log(health.data?.ok);