HFAI Cloud · integration
Node
on HFAI Cloud.
baseURL, apiKey, one constructor.
Two settings on the constructor.
Its own package,
its own option names.
The openai npm package describes itself as the official JavaScript and TypeScript library for the OpenAI API. Its constructor accepts an apiKey for authentication and, for an endpoint that is not the default one, a baseURL — the same two ideas as the Python client, capitalised the way this language spells options. Checked against github.com/openai/openai-node.
import OpenAI from 'openai';
const client = new OpenAI({
baseURL: 'https://api.heartflowai.net/v1',
apiKey: 'hfai_live_…',
});
const reply = await client.chat.completions.create({
model: 'gpt-oss:120b',
messages: [{ role: 'user', content: 'Hello HFAI' }],
});
console.log(reply.choices[0].message.content);
Construct the client once with both settings and every call it makes inherits them, which is what lets a long-running process keep one client while the model varies per request. The model string is ordinary text to the library, so any identifier the catalogue publishes can be passed in without a code change.
The package is maintained by OpenAI in its own repository, with its own release process. HeartFlowAI is not affiliated with that project, does not publish or patch the package, and nothing on this page implies that its maintainers have reviewed it. The option names were checked at github.com/openai/openai-node.
Any runtime that runs JavaScript.
Same object,
same endpoint.
The client object carries the endpoint for the life of the process, so a server and a script can share the same construction and differ only in the model they name.
Requests and failures are described in the API reference, the credit balance on HFAI Cloud, and GPT-OSS 120B is the free row.
One client per process.
Because the endpoint is a constructor option rather than a global setting, several clients with different keys can live in one process without interfering.