Node.js — API Store Hub

Anthropic hoặc OpenAI SDK trên Node.

Protocol
Anthropic + OpenAI
Config Path
npm install openai @anthropic-ai/sdk
Base URL
https://apistorehub.com (Anthropic) | https://apistorehub.com/v1 (OpenAI)
Node.js setup blueprint for API Store Hub
Step-by-step Node.js (Anthropic + OpenAI) setup using key prefix sk-ash- on API Store Hub.

Quick Setup Steps

  1. Create an API key in Dashboard (prefix sk-ash-).
  2. Apply configuration at npm install openai @anthropic-ai/sdk.
  3. Verify connectivity via GET /v1/models before running workloads.
import OpenAI from "openai";
const client = new OpenAI({ apiKey: process.env.API_KEY, baseURL: "https://apistorehub.com/v1" });

HTTP Status Codes & Troubleshooting

HTTPMeaningResolution
400Bad RequestValidate JSON payload, model ID, and request fields.
401UnauthorizedVerify API key and Authorization or x-api-key header.
402Payment RequiredInsufficient ST balance — top up credits in Dashboard.
403ForbiddenKey lacks permission for this model or is paused.
404Not FoundCheck base URL path (/v1 vs root) and active model ID.
413Payload Too LargeReduce prompt size or media payload.
429Too Many RequestsRate limit exceeded — apply exponential backoff and retry.
500 / 502 / 503 / 504Upstream / Gateway ErrorTransient upstream error — retry with backoff and keep x-request-id.