Skip to content
GetAPI
English
Menu

GetAPI.ONE

Call GetAPI.ONE from Node.js

Use the official OpenAI JavaScript SDK on a trusted Node.js runtime with the ONE base URL, an environment credential, and an exact catalog model.

Prepare a server-side project

  • A maintained Node.js release and an ESM project.
  • An enabled, bounded GetAPI.ONE key.
  • An exact current catalog model that declares the Responses endpoint.
shell
npm install openai

Create the client and request

  1. Inject GETAPI_ONE_API_KEY through the server process environment.
  2. Set baseURL to https://www.getapi.one/v1.
  3. Replace the placeholder with an exact current catalog ID.
  4. Run one small request only when you accept possible billing.
  5. The first check disables automatic retries. Add a bounded retry policy only after classifying safe-to-repeat operations.
node index.mjs
import OpenAI from 'openai';

const apiKey = process.env.GETAPI_ONE_API_KEY;
if (!apiKey) throw new Error('Set GETAPI_ONE_API_KEY before starting');

const client = new OpenAI({
  apiKey,
  baseURL: 'https://www.getapi.one/v1',
  timeout: 30_000,
  maxRetries: 0,
});

const response = await client.responses.create({
  model: '<MODEL_ID_FROM_CURRENT_CATALOG>',
  input: 'Reply with one short readiness check.',
});

console.log(response.output_text);

Keep runtime boundaries clear

DecisionUse
Endpoint basehttps://www.getapi.one/v1
Credential sourceprocess.env.GETAPI_ONE_API_KEY
ModelExact current catalog ID, not a guessed alias

Verify the expected result

  • The promise resolves and response.output_text contains the short reply.
  • No credential appears in client-side bundles, logs, or error pages.
  • A matching request or usage record is visible in the ONE console.

Fix common errors

SymptomAction
Missing key exceptionSet the variable in the same shell or service environment that launches Node.
401Re-copy the enabled ONE key and remove stray whitespace.
404 or unsupported operationKeep one /v1 and match the SDK method to the model’s declared endpoint.

Protect production usage

  • Store secrets in the deployment platform’s secret manager, not in package.json or frontend environment variables.
  • Apply request timeouts, error handling, and your own user authorization before exposing a server endpoint.
  • Rotate leaked keys and review usage records for unexpected calls.

Next steps