AI

Overview

Unified chat completions against the environment’s configured AI provider, plus usage queries.

API

{pe} = /projects/{projectId}/environments/{environmentId}.

MethodPathNotes
GET/ai/healthHealth
POST/ai{pe}/completionsOwner JWT (RequireAuthorization)
GET/ai{pe}/usageOwner JWT

Clients

PackageRuntime
@vijihub/aiserver
VijiHub.AI.NET
import { createAiClient } from '@vijihub/ai'

const ai = createAiClient({
  baseUrl: 'http://localhost:5600',
  projectId: '...',
  environmentId: '...',
  getAccessToken: () => auth.ensureAccessToken(),
})

const result = await ai.complete({
  messages: [
    { role: 'system', content: 'You are helpful.' },
    { role: 'user', content: 'Hello!' },
  ],
  temperature: 0.7,
})

Implementation

  1. Enable AI and configure a provider (API key, model defaults, optional tunnel base URL).
  2. Call completions from a trusted backend or Console session with Bearer token.
  3. Monitor GET …/usage.

Constraints

  • Completions require authorization (owner JWT) — treat as server/BFF capability.
  • Provider rate limits and model availability apply upstream.
  • Do not expose your provider keys to browsers; VijiHub stores them on the environment.