Skip to content

Node / Server JavaScript

This content is not available in your language yet.

import SdkAvailability from ‘../../../../components/SdkAvailability.astro’;

Server SDK는 token이나 비용을 직접 추정하지 않습니다. ABTO Gateway로 향하는 요청에 사용자·노드·trace context를 전달하고, Gateway가 실제 실행 telemetry를 기록하게 합니다.

import { createAbto } from '@abto-app/sdk/server';
const abto = createAbto({
apiKey: process.env.ABTO_API_KEY,
gatewayBaseURL: 'https://gateway.abto.app/v1',
environment: 'production',
});
const result = await abto.withContext(
{ userId: 'user-123', nodeId: 'resume.make' },
async () => {
const openai = await abto.openai();
return openai.chat.completions.create({
model: 'gpt-4.1-mini',
messages: [{ role: 'user', content: 'Draft a resume summary.' }],
});
},
);
  • userId: 제품 사용자 식별자
  • nodeId: AI 기능 또는 라우팅 노드. 예: resume.make
  • traceId: 여러 요청·행동을 묶는 흐름 식별자

Gateway는 API Key를 프로젝트로 해석하고 응답에 x-request-id를 발급합니다. Browser의 제품 행동은 이 request ID를 통해 같은 LLM 실행과 연결할 수 있습니다.