LLMOps

Configuration

The llmops() function accepts a configuration object that controls how LLMOps behaves. This page documents all available options.

Basic Example

llmops.ts
import { llmops } from '@llmops/sdk';
import { Pool } from 'pg';

export default llmops({
  basePath: '/llmops',
  providers: {
    openai: { apiKey: process.env.OPENAI_API_KEY },
  },
  database: new Pool({
    connectionString: process.env.DATABASE_URL,
  }),
});

Configuration Options

basePath

The URL path where LLMOps routes will be mounted. Must start with /.

basePath: '/llmops';

This determines where the dashboard and API endpoints are accessible:

  • Dashboard: http://localhost:3000/llmops
  • API: http://localhost:3000/llmops/api/genai/v1/chat/completions

providers

An object containing your LLM provider configurations. At least one provider must be configured.

providers: {
  openai: {
    apiKey: process.env.OPENAI_API_KEY,
  },
  anthropic: {
    apiKey: process.env.ANTHROPIC_API_KEY,
  },
}

See Providers below for detailed provider-specific options.


database

A PostgreSQL connection pool instance.

import { Pool } from 'pg';

database: new Pool({
  connectionString: process.env.DATABASE_URL,
});

You can also pass individual connection options:

database: new Pool({
  host: 'localhost',
  port: 5432,
  database: 'llmops',
  user: 'postgres',
  password: 'password',
});

schema

The PostgreSQL schema name where LLMOps tables will be created. Defaults to 'llmops'.

schema: 'llmops'; // default

This option:

  • Creates the schema if it doesn't exist (during migrations)
  • Sets search_path on every database connection
  • Isolates LLMOps tables from your application's tables
ValueBehavior
'llmops'Uses dedicated llmops schema (default)
'public'Uses the default PostgreSQL public schema
'custom'Uses a custom schema name of your choice
// Use public schema (not recommended for production)
schema: 'public';

// Use a custom schema
schema: 'my_llmops_schema';

Using a dedicated schema keeps LLMOps tables separate from your application tables, making it easier to manage and backup.


Providers Configuration

All providers share these base options:

PropertyTypeRequiredDescription
apiKeystringYesAPI key for the provider
customHoststringNoCustom base URL for the provider
requestTimeoutnumberNoRequest timeout in milliseconds
forwardHeadersstring[]NoHeaders to forward from incoming requests
providers: {
  openai: {
    apiKey: process.env.OPENAI_API_KEY,
  },
  anthropic: {
    apiKey: process.env.ANTHROPIC_API_KEY,
  },
  openrouter: {
    apiKey: process.env.OPENROUTER_API_KEY,
  },
}

You can configure multiple providers to use different models based on your needs. Once configured, you can create variants in the dashboard that use any of these providers.

For detailed configuration options for each provider, see the Providers page.


Complete Example

llmops.ts
import 'dotenv/config';
import { llmops } from '@llmops/sdk';
import { Pool } from 'pg';

export default llmops({
  basePath: '/llmops',

  providers: {
    openai: {
      apiKey: process.env.OPENAI_API_KEY!,
    },
    anthropic: {
      apiKey: process.env.ANTHROPIC_API_KEY!,
    },
    openrouter: {
      apiKey: process.env.OPENROUTER_API_KEY!,
    },
  },

  database: new Pool({
    connectionString: process.env.DATABASE_URL!,
  }),

  // PostgreSQL schema (defaults to 'llmops')
  schema: 'llmops',
});

Environment Variables

We recommend storing sensitive values in environment variables:

.env
# Database
DATABASE_URL=postgresql://postgres:password@localhost:5432/llmops

# Providers
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
OPENROUTER_API_KEY=sk-or-...

On this page