Skip to main content

Prerequisites

  1. You need to have a MatterAI account on https://app.matterai.so
  2. You need to have API Key for your MatterAI account. You can generate API Key in https://app.matterai.so/api-keys
Export an environment variable on macOS or Linux systems
export MATTERAI_API_KEY=YOUR_API_KEY
Install the OpenAI SDK and Run an API Call
import OpenAI from "openai";

const openai = new OpenAI({
apiKey: "MATTERAI_API_KEY",
baseURL: "https://api.matterai.so/v1",
});

async function main() {
const response = await openai.chat.completions.create({
    "model": "axon",
    "messages": [
        {
            "role": "system",
            "content": "You are a helpful assistant."
        },
        {
            "role": "user",
            "content": "What is Rust?"
        }
    ],
    "stream": false,
    "max_tokens": 1000,
    "reasoning": {
        "effort": "high",
        "summary": "none"
    },
    "response_format": {
        "type": "text"
    },
    "temperature": 0,
    "top_p": 1
});

console.log(response.choices[0].message.content);
}

main();
I