Skip to content

Quickstart, your first API call

5 minFor developers

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.

  1. 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.

  2. Terminal window
    export BASE='https://dummydomain'
    export API_KEY='paste-your-key-here'
  3. Install the OpenAI library (pip install openai or npm install openai), point it at your server, and pick a tier.

    import os
    from openai import OpenAI
    client = 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)

    The answer is in choices[0].message.content. Also look at choices[0].finish_reason. If it says length, the answer was cut short; ask for a shorter answer or raise max_tokens.

That’s it, ho gaya (done). Your app is talking to ZenithAI.

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.