Self-hosted AI

circle-check

Self-hosted AI

By default, AI features in Forest Admin are processed by Forest Admin servers. To keep your data private, you can route AI requests through your own agent using the addAi method—your data never leaves your infrastructure.

Installation

npm install @forestadmin/ai-proxy

Configuration

import { createAiProvider } from '@forestadmin/ai-proxy';

const agent = createAgent(options)
  .addDataSource(/* ... */)
  .addAi(
    createAiProvider({
      name: 'my-assistant',
      provider: 'openai',
      apiKey: process.env.OPENAI_API_KEY,
      model: 'gpt-4o',
    }),
  );

Options

Option
Type
Required
Description

name

string

Yes

Unique identifier for this AI configuration

provider

'openai' | 'anthropic'

Yes

AI provider

model

string

Yes

Model to use (see supported models below)

apiKey

string

No

API key (defaults to OPENAI_API_KEY or ANTHROPIC_API_KEY env var)

All provider-specific options are also supported: ChatOpenAI optionsarrow-up-right (configuration, temperature, maxTokens, etc.) and ChatAnthropic optionsarrow-up-right (anthropicApiUrl, temperature, maxTokens, topK, etc.).

Supported models

Any model with function/tool calling support works. See the full list of unsupported modelsarrow-up-right for details.

Last updated