Skip to main content

ai

ai — ɳSelf documentation.

AI Plugin

Multi-provider AI inference service with prompt marketplace and consensus mode. Pro plugin.

Requires: Basic license tier or higher. nself license set nself_pro_...

Install

nself license set nself_pro_xxxxx...
nself plugin install ai

What It Does

Runs a unified AI inference service supporting 7 providers: OpenAI, Anthropic, Gemini, Groq, Mistral, Ollama, and custom endpoints. Implements a 3-layer request pipeline (pre-processing → inference → post-processing), prompt marketplace for sharing and reusing prompts, consensus mode for multi-model agreement, and shadow testing to compare providers without affecting production. Required by the claw, mux, and voice plugins.

Configuration

Env VarDefaultDescription
AI_PORT3709AI service port
AI_DEFAULT_PROVIDERopenaiDefault inference provider
OPENAI_API_KEYnoneOpenAI API key
ANTHROPIC_API_KEYnoneAnthropic API key
GEMINI_API_KEYnoneGoogle Gemini API key
GROQ_API_KEYnoneGroq API key
MISTRAL_API_KEYnoneMistral API key
OLLAMA_HOSTnoneOllama server URL (for local models)
AI_CONSENSUS_THRESHOLD0.7Agreement threshold for consensus mode

Ports

PortPurpose
3709AI inference REST API

Database Tables

6 tables added to your Postgres database:

  • np_ai_providers: provider configurations and status
  • np_ai_prompts: prompt marketplace entries
  • np_ai_requests: inference request log
  • np_ai_responses: response cache and audit log
  • np_ai_pipeline_configs: 3-layer pipeline configurations
  • np_ai_shadow_tests: shadow testing results

Nginx Routes

RouteTarget
/ai/AI inference API

API

GET  /health: Health check
POST /chat: Chat completion (OpenAI-compatible)
POST /complete: Text completion
POST /embed: Embeddings
GET  /providers: List available providers
GET  /models: List available models
POST /prompts: Save to prompt marketplace
GET  /prompts: Browse marketplace

Used By

  • claw: AI agent reasoning
  • mux: Email/message classification
  • voice: Speech transcription and synthesis