API Store Hub에서 PHP Laravel 및 Node.js Express 연동

기존 Laravel 및 Express 백엔드에 콘텐츠 생성, 주문 요약, AI 챗봇 기능을 몇 분 만에 연동하세요.

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

API Store Hub에서 PHP Laravel 및 Node.js Express 연동 visual architecture diagram — API Store Hub
API Store Hub에서 PHP Laravel 및 Node.js Express 연동 · Base URL https://apistorehub.com · Key prefix sk-ash-

설치 명령어

LanguagePHP / TypeScript
RuntimePHP 8.2+ (Laravel 11) / Node.js 20+ (Express 5)
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. 스트리밍 및 재시도로 호출 실행: 명시적 타임아웃과 지터 재시도로 gpt-6.1-terra를 호출하세요. 모든 요청의 토큰, TTFT, 비용이 투명하게 기록됩니다.

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

PHP / TypeScript

import express from "express";
import OpenAI from "openai";

const app = express();
app.use(express.json());
const openai = new OpenAI({ baseURL: "https://apistorehub.com/v1", apiKey: process.env.API_KEY });

app.post("/chat", async (req, res) => {
  res.setHeader("Content-Type", "text/event-stream");
  res.setHeader("Cache-Control", "no-cache");
  const stream = await openai.chat.completions.create({
    model: "gpt-6.1-terra",
    stream: true,
    messages: [{ role: "user", content: String(req.body.prompt || "Hello") }],
  });
  for await (const chunk of stream) {
    const text = chunk.choices[0]?.delta?.content || "";
    if (text) res.write(`data: ${JSON.stringify({ text })}\n\n`);
  }
  res.end();
});

cURL

curl https://apistorehub.com/v1/chat/completions \
  -H "Authorization: Bearer sk-ash-your_key" \
  -H "Content-Type: application/json" \
  -d '{"model":"gpt-6.1-terra","messages":[{"role":"user","content":"Generate product meta description"}]}'

추천 모델 및 실시간 요금

모델토큰 단가컨텍스트 및 엔드포인트
GPT 6.1 Terra3,400 ST / 1M tokens1.1M
DeepSeek V4 Flash1,500 ST / 1M tokens1M
GPT Image 2.52,500 ST / req-

프로덕션 운영 체크리스트

  • 대량 생성이나 파일 분석 작업은 Laravel Queue 또는 BullMQ 워커로 분리해 PHP-FPM/HTTP 스레드 차단을 방지하세요.
  • 긴 응답(500토큰 초과)에는 항상 stream=true를 활성화해 TTFT를 줄이고 타임아웃을 방지하세요.
  • 클라이언트 코드에 API 키를 하드코딩하지 말고 서버 환경 변수로 주입하며 API Store Hub 콘솔에서 주기적으로 교체하세요.
  • 429/502/529 오류에 지터 포함 지수 백오프를 적용하고 동일 API 키로 폴백 모델을 구성하세요.

자주 묻는 질문

PHP Laravel & Node.js Express을(를) 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 콘솔에서 토큰 또는 요청 단위로 투명하게 과금되며 마이너스 잔액 없이 키별 지출 한도를 설정할 수 있습니다.