OpenAI Compatible Provider

Use any OpenAI-compatible API with PraisonAI TypeScript

Diagram

Input

Agent

Output

OpenAI Compatible Provider

Connect to any OpenAI-compatible API endpoint.

Environment Variables

bash
export OPENAI_COMPATIBLE_API_KEY=...
export OPENAI_COMPATIBLE_BASE_URL=https://api.example.com/v1

Quick Start

  1. Simple Usage
    typescript
    import { Agent } from 'praisonai';
    
    const agent = new Agent({
      name: 'CompatibleAgent',
      instructions: 'You are a helpful assistant.',
      llm: 'openai-compatible/my-model',
      llmConfig: {
        baseUrl: 'https://api.example.com/v1',
        apiKey: process.env.OPENAI_COMPATIBLE_API_KEY
      }
    });
    
    const response = await agent.chat('Hello!');
  2. With Configuration

    Adjust provider credentials and model settings for production — see the sections above.

Compatible Services

  • vLLM
  • LocalAI
  • Text Generation Inference
  • Anyscale
  • Custom deployments

Related