Trussed AI API Use Guide

Summary

Quick start guide for Trussed AI API users

Body

Trussed AI API Quick Start

 

The OwlChat Toolkit includes Trussed AI. Trussed AI provides FAU students, faculty, and staff with programmatic access to AI models for use in their own applications, scripts, notebooks, and development tools. Users can generate an API key and access available AI models without needing to interact with them through a chat interface.

Trussed AI is an AI routing tool that allows users to aggregate and select the best language models for their needs. It provides a unified interface to access multiple language models, including those from Azure, Google, and other providers. This tool is particularly useful for organizations that want to optimize their AI model usage by combining different models to achieve the best results. It also helps in tracking usage and setting budgets for different projects, ensuring cost efficiency. Trussed AI simplifies the process of accessing and managing multiple language models. Trussed AI acts as a central service to call over 100 language models, load balance, and track costs across projects. This is ideal for teams that need a centralized solution for managing AI models.

Trussed AI provides API access to AI models and other LLM services. Trussed provides a unified, OpenAI-style API, making it easier to integrate AI capabilities into existing applications and tools using a consistent request format.

Depending on the access provided to your account or team, the API can be used to:

  • View the models available to your account
  • Send prompts to generative AI models using chat completions
  • Generate embeddings for search, retrieval, and other applications
  • Connect applications, scripts, notebooks, and compatible coding tools to AI models

 

You should have received your API key after requesting access to the OwlChat Toolkit. Keep this key secure, as it is used to authenticate your requests to Trussed AI. 

  1. To gain access to OwlChat Toolkit submit a ticket requesting access. An invite will be sent once the request is approved.
  2. Once access has been granted, follow the provided Invite link to create and activate your account.
  3. Once your account is activated visit https://trussed.ai..hpc.fau.edu to login.

 

This guide provides simple curl and Python examples that you can copy and modify for your own use.

Quick Reference

If you are comfortable with OpenAI style API calls you can use this table to quickly get started. For more information see the specific endpoints below.

 

Base URL https://trussed.ai.hpc.fau.edu/provider/generic
Authorization Authorization: Bearer <your API key>
List models /models
Chat completions

/chat/completions

Embeddings /embeddings

 

Set Your API Key

Your API key should be kept private. Do not include it directly in scripts, notebooks, Git repositories, or shared documents.

Use best practices such as setting it as an environment variable to avoid accidental exposure.

 

Linux / macOS

 

Open a terminal and run:

export API_KEY="your-api-key-here"
export BASE_URL="https://trussed.ai.hpc.fau.edu/provider/generic"

 

Python

 

The examples below read the same environment variable:

 

import os

API_KEY = os.environ["API_KEY"]
BASE_URL = os.environ["BASE_URL"] 

 

Install the Python `requests` package if you do not already have it:

Open a terminal and run:

pip install requests

 

---

 

List Available Models

 

Before making a request, you can see which models are available to you.

 

curl

 

curl -X GET \
"$BASE_URL/models" \
-H "accept: application/json" \
-H "Authorization: Bearer $API_KEY"

 

Python

 

import os
import requests

API_KEY = os.environ["API_KEY"]
BASE_URL = os.environ["BASE_URL"]

def trussed_models():
"""Returns available models."""
  headers = {
    "accept": "application/json",
    "Content-Type": "application/json",
    "Authorization": f"Bearer {API_KEY}"
  }

  try:
    r = requests.get(
    url = BASE_URL,
    headers=headers
    )
    r.raise_for_status()
    return r.json()

  except Exception as e:
    return {"error": str(e)}

print(trussed_models())

 

Choose a model from the returned list for your API requests.

 

Chat Completions

 

Chat completion requests send a message to a language model and return its response.

 

The example below uses `gemma4-vibe`. Replace it with another model available to you if needed.

 

curl

 

curl -X POST \
"$BASE_URL/chat/completions" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{
"model": "gemma4-vibe",
"messages": [
{
"role": "user",
"content": "Explain machine learning in simple terms."
}

]

}'


 

Python

 

import os
import requests

API_KEY = os.environ["API_KEY"]
BASE_URL = os.environ["BASE_URL"]
MODEL = "gemma4-vibe"

def chat_trussed(prompt="Hi"):
  """Sends a chat request to Trussed AI."""
  headers = {
    "accept": "application/json",
    "Content-Type": "application/json",
    "Authorization": f"Bearer {API_KEY}"
  }

  data = {
    "model": MODEL,
    "messages": [
    {
      "role": "user",
      "content": prompt
    }
    ]
  }

  try:
    r = requests.post(
    BASE_URL,
    headers=headers,
    json=data
    )

    r.raise_for_status()
    return r.json()["choices"][0]["message"]["content"]

  except Exception as e:
    return {"error": str(e)}


print(chat_trussed("Explain machine learning in simple terms."))

 

Embeddings

 

Embeddings convert text into a numerical representation that can be used for applications such as semantic search, similarity comparisons, and retrieval systems.

 

Use an **embedding model available to your account** in place of `YOUR_EMBEDDING_MODEL`.

 

curl

curl -X POST \

"https://trussed.ai.hpc.fau.edu/provider/generic/embeddings" \
-H "accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $API_KEY" \
-d '{
"model": "YOUR_EMBEDDING_MODEL",
"input": "This is the text I want to convert into an embedding."
}'

 

Python

 

import os
import requests


API_KEY = os.environ["API_KEY"]
EMBEDDING_MODEL = "YOUR_EMBEDDING_MODEL"


def trussed_embedding(text):
  """Creates an embedding using Trussed AI."""

  headers = {
    "accept": "application/json",
    "Content-Type": "application/json",
    "Authorization": f"Bearer {API_KEY}"
  }

  data = {
    "model": EMBEDDING_MODEL,
    "input": text
  }

  try:
    r = requests.post(
    "https://trussed.ai.hpc.fau.edu/provider/generic/embeddings",
    headers=headers,
    json=data
    )
    r.raise_for_status()
    return r.json()

  except Exception as e:
    return {"error": str(e)}

result = trussed_embedding(

"This is the text I want to convert into an embedding."

)


print(result)

 

 

IDE Coding Assistant

 

IDEs (such as VS Code) and coding assistants that support generic or OpenAI style API connections will work with Trussed AI.

  • Set the base URL : https://trussed.ai.hpc.fau.edu/provider/generic
  • Set the API key: your-api-key

 

Important: Never share your API key or commit it to Git. Store it in an environment variable.

 

Details

Details

Article ID: 164827
Created
Fri 9/25/26 1:25 PM
Modified
Thu 10/1/26 5:08 PM