Quickstart

This guide will help you get started using the Avian API with Python.

Avian's API is OpenAI compatible, including their libraries and schema.

Step 1: Create an API Key

First, create an Avian account or sign in.

Next, navigate to the API Key page, click "New API Key" and give it a name.

Make sure to save this somewhere safe and do not share it with anyone.

Already familiar? Head over to our API Reference.

Send your first request

Create a file named avian-test.py and add the following code:

from openai import OpenAI

client = OpenAI(
    api_key="avian-your-api-key-here",
    base_url="https://api.avian.io/v1"
)

completion = client.chat.completions.create(
  model="llama-3.1-405b-instruct",
  messages=[
    {"role": "system", "content": "You are a poetic assistant, skilled in explaining complex programming concepts with creative flair."},
    {"role": "user", "content": "Compose a poem that explains the concept of recursion in programming."}
  ]
)

print(completion.choices[0].message)

Make sure to change avian-your-api-key-here to your API Key you created.

Run the script:

python avian-test.py

Last updated