Get started
Set up a key and your environment
Create a project API key, set the three environment variables every tool reads, and install the SDK or CLI you want to use.
Create an API key
In the console, open your project and go to API keys, then create a key. Give it a name that says where it will be used and only the scopes that code needs, for example inference:invoke for an application that only calls models. The key (it starts with sk_) is shown once, when it is created: store it in your secret manager straight away. See Projects and API keys for scopes and expiry.
A key always acts in the project it was created in. You never pass a project ID with a key.
Set the environment
| Variable | Value |
|---|---|
API_KEY | sk_… (your project API key) |
API_BASE_URL | https://api.hayonix.ai/v1 |
INFERENCE_BASE_URL | https://api.hayonix.ai/v1 |
Every example in these docs reads these variables, and so do both SDKs and the CLI. Some examples also read inputs such as MODEL; each one lists its inputs and their defaults.
Install a client
You can call the API with any HTTP client. The official tools add typed methods, retries, pagination, waiting helpers and the OpenAI client for inference.
TypeScript (a current Node.js LTS release, Bun or Deno):
npm install hayonixPython 3.11 or later (the openai extra adds client.openai()):
pip install "hayonix[openai]"The command-line tool, hayonix:
npm install -g hayonix-cliCheck that it works
The SDK fetches who the key is (its org, project and permissions) on first use. This is the TypeScript SDK guide's first sample:
import { Client } from 'hayonix';
// API_KEY, API_BASE_URL and INFERENCE_BASE_URL come from the environment by default.
const client = new Client({
timeout: 30_000, // per attempt, in milliseconds (default 60 000)
maxRetries: 3, // retries of a retryable failure (default 2)
});
const me = await client.caller(); // the key's org, project and permissions
console.log('project:', me.project_id);If this prints your project ID, you are ready for a quickstart.