Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
137 changes: 137 additions & 0 deletions flutter_app/lib/models/ai_provider.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
import 'package:flutter/material.dart';

/// Metadata for an AI model provider that can be configured
/// to power the OpenClaw gateway.
class AiProvider {
final String id;
final String name;
final String description;
final IconData icon;
final Color color;
final String baseUrl;
final List<String> defaultModels;
final String apiKeyHint;

const AiProvider({
required this.id,
required this.name,
required this.description,
required this.icon,
required this.color,
required this.baseUrl,
required this.defaultModels,
required this.apiKeyHint,
});

static const anthropic = AiProvider(
id: 'anthropic',
name: 'Anthropic',
description: 'Claude models — advanced reasoning and coding',
icon: Icons.psychology,
color: Color(0xFFD97706),
baseUrl: 'https://api.anthropic.com/v1',
defaultModels: [
'claude-sonnet-4-20250514',
'claude-opus-4-20250514',
'claude-haiku-4-20250506',
'claude-3-5-sonnet-20241022',
],
apiKeyHint: 'sk-ant-...',
);

static const openai = AiProvider(
id: 'openai',
name: 'OpenAI',
description: 'GPT and o-series models',
icon: Icons.auto_awesome,
color: Color(0xFF10A37F),
baseUrl: 'https://api.openai.com/v1',
defaultModels: [
'gpt-4o',
'gpt-4o-mini',
'o1',
'o1-mini',
'gpt-4-turbo',
],
apiKeyHint: 'sk-...',
);

static const google = AiProvider(
id: 'google',
name: 'Google Gemini',
description: 'Gemini family of multimodal models',
icon: Icons.diamond,
color: Color(0xFF4285F4),
baseUrl: 'https://generativelanguage.googleapis.com/v1beta',
defaultModels: [
'gemini-2.5-pro',
'gemini-2.5-flash',
'gemini-2.0-flash',
'gemini-1.5-pro',
],
apiKeyHint: 'AIza...',
);

static const openrouter = AiProvider(
id: 'openrouter',
name: 'OpenRouter',
description: 'Unified API for hundreds of models',
icon: Icons.route,
color: Color(0xFF6366F1),
baseUrl: 'https://openrouter.ai/api/v1',
defaultModels: [
'anthropic/claude-sonnet-4',
'openai/gpt-4o',
'google/gemini-2.5-pro',
'meta-llama/llama-3.1-405b-instruct',
],
apiKeyHint: 'sk-or-...',
);

static const nvidia = AiProvider(
id: 'nvidia',
name: 'NVIDIA NIM',
description: 'GPU-optimized inference endpoints',
icon: Icons.memory,
color: Color(0xFF76B900),
baseUrl: 'https://integrate.api.nvidia.com/v1',
defaultModels: [
'meta/llama-3.1-405b-instruct',
'meta/llama-3.1-70b-instruct',
'nvidia/nemotron-4-340b-instruct',
],
apiKeyHint: 'nvapi-...',
);

static const deepseek = AiProvider(
id: 'deepseek',
name: 'DeepSeek',
description: 'High-performance open models',
icon: Icons.explore,
color: Color(0xFF0EA5E9),
baseUrl: 'https://api.deepseek.com/v1',
defaultModels: [
'deepseek-chat',
'deepseek-reasoner',
],
apiKeyHint: 'sk-...',
);

static const xai = AiProvider(
id: 'xai',
name: 'xAI',
description: 'Grok models from xAI',
icon: Icons.bolt,
color: Color(0xFFEF4444),
baseUrl: 'https://api.x.ai/v1',
defaultModels: [
'grok-3',
'grok-3-mini',
'grok-2',
],
apiKeyHint: 'xai-...',
);

/// All available AI providers.
static const all = [anthropic, openai, google, openrouter, nvidia, deepseek, xai];
}
24 changes: 23 additions & 1 deletion flutter_app/lib/models/optional_package.dart
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,30 @@ class OptionalPackage {
completionSentinel: 'BREW_INSTALL_COMPLETE',
);

static const sshPackage = OptionalPackage(
id: 'ssh',
name: 'OpenSSH',
description: 'SSH client and server for secure remote access',
icon: Icons.vpn_key,
color: Colors.teal,
installCommand:
'set -e; '
'echo ">>> Installing OpenSSH..."; '
'apt-get update -qq && apt-get install -y openssh-client openssh-server; '
'ssh -V; '
'echo ">>> SSH_INSTALL_COMPLETE"',
uninstallCommand:
'set -e; '
'echo ">>> Removing OpenSSH..."; '
'apt-get remove -y openssh-client openssh-server && apt-get autoremove -y; '
'echo ">>> SSH_UNINSTALL_COMPLETE"',
checkPath: 'usr/bin/ssh',
estimatedSize: '~10 MB',
completionSentinel: 'SSH_INSTALL_COMPLETE',
);

/// All available optional packages.
static const all = [goPackage, brewPackage];
static const all = [goPackage, brewPackage, sshPackage];

/// Sentinel for uninstall completion (derived from install sentinel).
String get uninstallSentinel =>
Expand Down
Loading
Loading