Quickstart, your first API call
This page takes you from zero to a working API call. You need a ZenithAI account on your organisation’s server. If you don’t have one, ask your ZenithAI administrator to create it for you.
-
Create an API key
Section titled “Create an API key”Sign in to ZenithAI in your browser. Open Settings, choose API keys in the left menu, type a key name you will recognise later, such as billing-bot, and click Create key.
-
Keep the address and key out of your code
Section titled “Keep the address and key out of your code”Terminal window export BASE='https://dummydomain'export API_KEY='paste-your-key-here'Terminal window $env:BASE = "https://dummydomain"$env:API_KEY = "paste-your-key-here" -
Send your first message
Section titled “Send your first message”Install the OpenAI library (
pip install openaiornpm install openai), point it at your server, and pick a tier.import osfrom openai import OpenAIclient = OpenAI(base_url=os.environ["BASE"] + "/v1", api_key=os.environ["API_KEY"])reply = client.chat.completions.create(model="Fast",messages=[{"role": "user", "content": "Write a polite two-line reminder for a pending invoice."}],)print(reply.choices[0].message.content)import OpenAI from "openai";const client = new OpenAI({ baseURL: `${process.env.BASE}/v1`, apiKey: process.env.API_KEY });const reply = await client.chat.completions.create({model: "Fast",messages: [{ role: "user", content: "Write a polite two-line reminder for a pending invoice." }],});console.log(reply.choices[0].message.content);Terminal window curl --fail-with-body "https://dummydomain/v1/chat/completions" \-H "Authorization: Bearer $API_KEY" -H 'Content-Type: application/json' \-d '{"model":"Fast","messages":[{"role":"user","content":"Write a polite two-line reminder for a pending invoice."}]}'The answer is in
choices[0].message.content. Also look atchoices[0].finish_reason. If it sayslength, the answer was cut short; ask for a shorter answer or raisemax_tokens.
That’s it, ho gaya (done). Your app is talking to ZenithAI.
Watch it end to end
Section titled “Watch it end to end”Next steps
Section titled “Next steps”Common questions
Where do I get a ZenithAI API key?
Sign in to ZenithAI in your browser, open Settings, then API keys, and click Create key. Copy the key straight away, because it is shown only once. Each person can have up to 20 keys.
Do I need a special SDK for ZenithAI?
No. ZenithAI accepts the OpenAI chat format, so the official OpenAI libraries for Python and JavaScript work. Change the base URL to your server and use a tier name such as Fast as the model.
Which tier should I use for my first call?
Start with Fast. It suits everyday chat, summaries and extraction. Move to Smart or Genius when you need careful reasoning over long documents, or function calling.