Model Provider

Tarko follows the OpenAI Compatible protocol to connect to any LLM provider, including Volcengine, OpenAI, Anthropic, Gemini, and more.

Configuration

Configure your model provider in the Agent configuration:

import { Agent } from '@tarko/agent';

const agent = new Agent({
  model: {
    provider: 'openai',
    apiKey: process.env.OPENAI_API_KEY,
    model: 'gpt-4'
  }
});

Supported Providers

OpenAI

{
  provider: 'openai',
  apiKey: 'your-api-key',
  model: 'gpt-4'
}

Anthropic

{
  provider: 'anthropic',
  apiKey: 'your-api-key',
  model: 'claude-3-sonnet'
}

Volcengine

{
  provider: 'volcengine',
  apiKey: 'your-api-key',
  model: 'doubao-pro'
}

Custom Provider

You can also use any OpenAI-compatible endpoint:

{
  provider: 'custom',
  baseURL: 'https://your-endpoint.com/v1',
  apiKey: 'your-api-key',
  model: 'your-model'
}