Find ai runnerAPI Reference

API Reference

Complete API reference for @visulima/find-ai-runner

API Reference

Functions

detectAllProviders()

Returns info for all 11 supported providers, whether installed or not.

function detectAllProviders(): AiProviderInfo[];

detectAvailableProviders()

Returns only providers that are installed on the system.

function detectAvailableProviders(): AiProviderInfo[];

detectProvider(name)

Detect a specific provider by name. Returns provider info including availability, path, version, and detection method.

function detectProvider(name: AiProviderName): AiProviderInfo;

buildCliArgs(name, prompt, options?)

Build the CLI arguments array for a provider without executing. Useful for previewing or logging what command would be run.

function buildCliArgs(name: AiProviderName, prompt: string, options?: AiRunOptions): string[];

runProvider(provider, prompt, options?)

Execute a prompt against a detected provider. Uses spawn with stdin closed immediately for non-interactive execution. The process environment is sanitized with NO_COLOR=1 and FORCE_COLOR=0 for clean output.

function runProvider(provider: AiProviderInfo, prompt: string, options?: AiRunOptions): Promise<AiRunResult>;

Throws:

  • If the provider is not available
  • If the process times out
  • If the process exits with a non-zero code

Constants

PROVIDERS

The full provider configuration map.

const PROVIDERS: Record<AiProviderName, AiProviderConfig>;

PROVIDER_NAMES

All supported provider names in alphabetical order.

const PROVIDER_NAMES: AiProviderName[];
// ["amp", "claude", "codex", "copilot", "crush", "cursor", "droid", "gemini", "kimi", "opencode", "qwen"]

Types

AiProviderName

Union of all supported provider name strings.

type AiProviderName = "amp" | "claude" | "codex" | "copilot" | "crush" | "cursor" | "droid" | "gemini" | "kimi" | "opencode" | "qwen";

AiProviderInfo

Information about a detected AI CLI provider.

interface AiProviderInfo {
    /** Provider name. */
    name: AiProviderName;
    /** Whether the provider was found on the system. */
    available: boolean;
    /** How the provider was detected. */
    detectionMethod?: "envvar" | "which" | "known-path";
    /** Absolute path to the CLI binary. */
    path?: string;
    /** Detected version string (e.g., "1.2.3"). */
    version?: string;
}

AiProviderConfig

Configuration for an AI CLI provider.

interface AiProviderConfig {
    /** Primary CLI command name. */
    command: string;
    /** Alternate CLI command names to try. */
    alternateCommands: string[];
    /** Environment variable that can override the CLI path. */
    envVariable: string;
    /** Default model to use if none specified. Empty string means provider-default. */
    defaultModel: string;
    /** Builds the CLI arguments array for a given prompt, model, and max tokens. */
    buildArgs: (prompt: string, model: string, maxTokens: number) => string[];
}

AiRunOptions

Options for running a prompt against an AI provider.

interface AiRunOptions {
    /** Model override (e.g., "claude-opus-4-20250514"). */
    model?: string;
    /** Maximum tokens in the response. Defaults to 4096. */
    maxTokens?: number;
    /** Timeout in milliseconds. Defaults to 300000 (5 minutes). */
    timeoutMs?: number;
}

AiRunResult

Result from running a prompt against an AI provider.

interface AiRunResult {
    /** Which provider was used. */
    provider: AiProviderName;
    /** Standard output from the CLI (the AI response). */
    stdout: string;
    /** Standard error output from the CLI. */
    stderr: string;
}
Support

Contribute to our work and keep us going

Community is the heart of open source. The success of our packages wouldn't be possible without the incredible contributions of users, testers, and developers who collaborate with us every day.Want to get involved? Here are some tips on how you can make a meaningful impact on our open source projects.

Ready to help us out?

Be sure to check out the package's contribution guidelines first. They'll walk you through the process on how to properly submit an issue or pull request to our repositories.

Submit a pull request

Found something to improve? Fork the repo, make your changes, and open a PR. We review every contribution and provide feedback to help you get merged.

Good first issues

Simple issues suited for people new to open source development, and often a good place to start working on a package.
View good first issues