Using the Model Garden via the API

Introduction

Orq.ai exposes the Model Garden to the API for programmatic manipulation.


Prerequisite

To get started, an API key is needed to use within SDKs or HTTP API.

📘

To get an API key ready, see Authentication.

SDKs


Listing Models in the Garden

To get started we'll use the List models API.

curl --request GET \
     --url https://api.orq.ai/v2/models \
     --header 'accept: application/json' \
     --header 'authorization: Bearer ORQ_API_KEY'
import { Orq } from "@orq-ai/node";

const orq = new Orq({
  apiKey: process.env["ORQ_API_KEY"] ?? "",
});

async function run() {
  const result = await orq.models.list();

  console.log(result);
}

run();
from orq_ai_sdk import Orq
import os

with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.models.list()

    assert res is not None

    # Handle response
    print(res)

This call returns a list of all available models, see after:

{
  "object": "list",
  "data": [
    {
      "id": "[email protected]",
      "created": 1709510400000,
      "type": "chat",
      "owned_by": "vendor"
    },
    {
      "id": "[email protected]",
      "created": 1709510400000,
      "type": "chat",
      "owned_by": "vendor"
    },
    {
      "id": "anthropic@claude-3-5-haiku-20241022",
      "created": 1718780162791,
      "type": "chat",
      "owned_by": "vendor"
    },
    ..cont
}