Skip to content

DocsGetting started

SDKs & frameworks

Anything that can call OpenAI's Chat Completions API can call Avenro: point it at the base URL and use your key.

OpenAI SDK for JavaScript and TypeScript

Install
npm install openai
client.ts
import OpenAI from "openai";

export const avenro = new OpenAI({
  apiKey: process.env.AVENRO_API_KEY,
  baseURL: "https://api.avenro.tech/v1",
});

const completion = await avenro.chat.completions.create({
  model: "llama-3.1-70b-instruct",
  messages: [{ role: "user", content: "Summarize the plot of Hamlet in two sentences." }],
});

Use chat.completions: Avenro implements the Chat Completions API, not OpenAI's Responses API.

OpenAI SDK for Python

Install
pip install openai
client.py
import os
from openai import OpenAI

avenro = OpenAI(api_key=os.environ["AVENRO_API_KEY"], base_url="https://api.avenro.tech/v1")

completion = avenro.chat.completions.create(
    model="llama-3.1-70b-instruct",
    messages=[{"role": "user", "content": "Summarize the plot of Hamlet in two sentences."}],
)

Vercel AI SDK

Use the OpenAI-compatible provider, which calls the Chat Completions API. Streaming, tool calls and structured output work through the usual AI SDK functions.

Install
npm install ai @ai-sdk/openai-compatible
ai.ts
import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { streamText } from "ai";

const avenro = createOpenAICompatible({
  name: "avenro",
  baseURL: "https://api.avenro.tech/v1",
  apiKey: process.env.AVENRO_API_KEY,
});

const result = streamText({
  model: avenro.chatModel("llama-3.1-70b-instruct"),
  prompt: "Write a limerick about latency.",
});

for await (const text of result.textStream) process.stdout.write(text);

Any HTTP client

Send JSON to POST https://api.avenro.tech/v1/chat/completions with the bearer header. See the chat completions reference for the request and response format.