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.
npm install openaiCreate the client and request
- Inject GETAPI_ONE_API_KEY through the server process environment.
- Set baseURL to https://www.getapi.one/v1.
- Replace the placeholder with an exact current catalog ID.
- Run one small request only when you accept possible billing.
- The first check disables automatic retries. Add a bounded retry policy only after classifying safe-to-repeat operations.
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
| Decision | Use |
|---|---|
| Endpoint base | https://www.getapi.one/v1 |
| Credential source | process.env.GETAPI_ONE_API_KEY |
| Model | Exact 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
| Symptom | Action |
|---|---|
| Missing key exception | Set the variable in the same shell or service environment that launches Node. |
| 401 | Re-copy the enabled ONE key and remove stray whitespace. |
| 404 or unsupported operation | Keep 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.