API Store Hub에서 Zalo OA 및 Telegram 챗봇 연동

Zalo OA 및 Telegram 웹훅 환경에 맞춰 대화 히스토리 압축과 max_tokens 제어를 적용한 즉답 고객지원 봇을 구축하세요.

API Store Hub의 단일 API 키, 투명한 요금제, 멀티 프로바이더 페일오버로 프로덕션 AI를 시작하세요.

API Store Hub에서 Zalo OA 및 Telegram 챗봇 연동 visual architecture diagram — API Store Hub
API Store Hub에서 Zalo OA 및 Telegram 챗봇 연동 · Base URL https://apistorehub.com · Key prefix sk-ash-

설치 명령어

LanguageTypeScript
RuntimeNode.js 20+, Grammy / Telegraf / Zalo OA Webhook
ProtocolOpenAI Compatible (/v1/chat/completions)
설치 명령어npm install openai express

3단계 빠른 설정 절차

  1. API Store Hub에서 API 키 발급: API Store Hub 콘솔에 로그인해 sk-ash- 접두사 키를 생성하고 필요 시 일/월 사용 한도를 설정하세요.
  2. SDK 설치 및 Base URL 설정: 공식 패키지를 설치하고 환경 변수를 https://apistorehub.com로 지정해 /v1/chat/completions 엔드포인트를 호출합니다.
  3. 스트리밍 및 재시도로 호출 실행: 명시적 타임아웃과 지터 재시도로 deepseek-v4-flash를 호출하세요. 모든 요청의 토큰, TTFT, 비용이 투명하게 기록됩니다.

프로덕션 바로 적용 코드 예제

TypeScript

import OpenAI from "openai";

const ai = new OpenAI({ baseURL: "https://apistorehub.com/v1", apiKey: process.env.API_KEY });

export async function handleChatWebhook(userId: string, text: string, sendReply: (msg: string) => Promise<void>) {
  const completion = await ai.chat.completions.create({
    model: "deepseek-v4-flash",
    max_tokens: 512,
    messages: [
      { role: "system", content: "You are a helpful Vietnamese customer support assistant. Keep answers under 4 sentences." },
      { role: "user", content: `[user:${userId}] ${text}` },
    ],
  });
  const answer = completion.choices[0]?.message?.content?.trim() || "Vui lòng thử lại sau ít phút.";
  await sendReply(answer);
}

cURL

curl https://apistorehub.com/v1/chat/completions \
  -H "Authorization: Bearer sk-ash-your_key" \
  -H "Content-Type: application/json" \
  -d '{"model":"deepseek-v4-flash","max_tokens":256,"messages":[{"role":"user","content":"Chính sách đổi trả hàng trong bao lâu?"}]}'

추천 모델 및 실시간 요금

모델토큰 단가컨텍스트 및 엔드포인트
DeepSeek V4 Flash1,500 ST / 1M tokens1M
Gemini 3.8 Flash5,200 ST / 1M tokens1M
Claude Haiku 5.5400 ST / 1M tokens200K

프로덕션 운영 체크리스트

  • 중복 이벤트 재전송을 막으려면 웹훅에 즉시 HTTP 200을 응답한 뒤 비동기로 AI 답변을 발송하세요.
  • 긴 응답(500토큰 초과)에는 항상 stream=true를 활성화해 TTFT를 줄이고 타임아웃을 방지하세요.
  • 클라이언트 코드에 API 키를 하드코딩하지 말고 서버 환경 변수로 주입하며 API Store Hub 콘솔에서 주기적으로 교체하세요.
  • 429/502/529 오류에 지터 포함 지수 백오프를 적용하고 동일 API 키로 폴백 모델을 구성하세요.

자주 묻는 질문

Zalo OA & Telegram Chatbot을(를) API Store Hub에 연동할 때 기존 호출 로직을 수정해야 하나요?
아니요. API Store Hub는 OpenAI(https://apistorehub.com/v1)와 Anthropic Messages(https://apistorehub.com/v1/messages) 스키마를 그대로 호환하므로 Base URL과 sk-ash- 키만 변경하면 됩니다.
하나의 API 키로 스트리밍, 함수 호출, 임베딩을 모두 사용할 수 있나요?
네. API Store Hub의 단일 키 하나로 SSE 스트리밍, 엄격한 JSON Schema, 툴 호출, 임베딩을 포함한 전체 187개 모델을 이용할 수 있습니다.
과금과 속도 제한은 어떻게 관리되나요?
모든 요청은 API Store Hub 콘솔에서 토큰 또는 요청 단위로 투명하게 과금되며 마이너스 잔액 없이 키별 지출 한도를 설정할 수 있습니다.