use anyhow::Result;
use clap::{Args, Parser};
use toast_api::{agent_cli, server, unified_cli};
#[derive(Parser, Debug)]
#[clap(
author,
version,
about = "LLM API client and server (Claude and DeepSeek)"
)]
struct CliArgs {
#[clap(short, long)]
serve: bool,
#[clap(short = 'd', long)]
deepseek: bool,
#[clap(short = 'o', long, conflicts_with = "sonnet")]
opus: bool,
#[clap(short = 'k', long, conflicts_with = "opus")]
haiku: bool,
#[clap(long, conflicts_with = "opus")]
sonnet: bool,
#[clap(short = 'a', long)]
agent: bool,
#[clap(flatten)]
server_args: ServerArgs,
}
#[derive(Args, Debug, Clone)]
struct ServerArgs {
#[clap(long, default_value = "3000")]
port: u16,
#[clap(long, default_value = "claude-sonnet-4-claude-ai")]
model: String,
#[clap(long, default_value = "0.0.0.0")]
host: String,
#[clap(long)]
debug: bool,
}
#[tokio::main]
async fn main() -> Result<()> {
env_logger::init();
let args = CliArgs::parse();
if args.serve {
let server_args = server::Args {
port: args.server_args.port,
model: args.server_args.model,
host: args.server_args.host,
debug: args.server_args.debug,
};
server::run_with_args(server_args).await
} else if args.agent {
agent_cli::run_agent_cli(args.deepseek, args.opus, args.haiku).await
} else {
let cli_args = unified_cli::UnifiedArgs {
use_deepseek: args.deepseek,
use_opus: args.opus,
use_haiku: args.haiku,
use_sonnet: args.sonnet,
};
unified_cli::run(cli_args).await
}
}