Get API

GET API · Developer integrations

The important boundaries for a Node.js multi-model integration

A Node.js service can send a compatible SDK or fetch request to https://relay-api.getapi.pro/v1/chat/completions, authenticate with a server-side Bearer API key, and select a catalog model. Never bundle the production key into browser code; use AbortSignal for total deadlines, cap concurrency and retries, and validate both streaming events and final output completeness.

Keep the credential on the server

Any environment variable included in a browser bundle can be read by users. Let the web application call its own Node.js backend, where Get API authentication and application authorization can be enforced.

  • Avoid client-exposed prefixes for secrets
  • Authenticate users at the application API
  • Redact keys from logs and error responses

Cancel requests that no longer have value

A request that continues after navigation, upstream timeout, or a business deadline consumes concurrency and cost. Pass an AbortController from the request lifecycle into the model call.

  • Set an overall deadline for every call
  • Distinguish cancellation from upstream failure
  • Clean stream listeners and buffers

Use a complete streaming state machine

A network chunk is not necessarily a complete protocol event. Handle start, delta, completion, failure, and cancellation explicitly, prevent duplicate assembly after reconnects, and validate structured output only after completion.

  • Parse complete event boundaries only
  • Define how partial content behaves on failure
  • Validate required fields after completion

Frequently asked questions

Can a Node.js API key use VITE_ or NEXT_PUBLIC_ variables?

A production key should not. Those prefixes commonly expose values to browser bundles; use server-only configuration.

Why use AbortController?

It stops calls that no longer matter after user cancellation or timeout, reducing wasted concurrency and resources.

Can each streaming network chunk be JSON parsed directly?

Usually not. Transport chunks may split protocol events, which need to be assembled at the documented event boundary.

Business inquiries: business@honeykid.cn