Skip to main content

aider -- API Specification

Version: v1.0.0 | Status: Active | Last Updated: March 2026

Module: codomyrmex.aider​

Module-Level Exports​

NameTypeDescription
HAS_AIDERboolTrue when aider binary is found in PATH at import time
AiderRunnerclassSubprocess wrapper for aider CLI
AiderConfigdataclassEnvironment-sourced configuration
get_configfunctionFactory for AiderConfig
get_aider_versionfunctionReturns installed aider version string
AiderErrorexceptionBase exception class
AiderNotInstalledErrorexceptionAider binary not found
AiderTimeoutErrorexceptionSubprocess timeout exceeded
AiderAPIKeyErrorexceptionAPI key missing or invalid

AiderRunner​

Module: codomyrmex.aider.core

Constructor​

AiderRunner(model: str = "", timeout: int = 300)
ParameterTypeDefaultDescription
modelstr""LLM model name. If empty, reads from AiderConfig.model
timeoutint300Subprocess timeout in seconds

Behavior: Calls get_config() internally to resolve default model. Does not validate that aider is installed -- validation happens at method call time.


run_message(files, instruction)​

def run_message(self, files: list[str], instruction: str) -> dict[str, str]

Run aider in code mode with a single instruction.

ParameterTypeDescription
fileslist[str]File paths to include in aider context
instructionstrNatural-language instruction for the edit

Returns: dict with keys:

  • stdout (str) -- captured standard output
  • stderr (str) -- captured standard error
  • returncode (str) -- process exit code as string

Raises:

  • AiderNotInstalledError -- aider binary not in PATH
  • AiderTimeoutError -- subprocess exceeded timeout

run_ask(files, question)​

def run_ask(self, files: list[str], question: str) -> dict[str, str]

Run aider in ask mode (no file changes).

ParameterTypeDescription
fileslist[str]File paths to include as context
questionstrQuestion to ask about the code

Returns: dict with keys: stdout, stderr, returncode

Raises: AiderNotInstalledError, AiderTimeoutError


run_architect(files, task, editor_model)​

def run_architect(
self, files: list[str], task: str, editor_model: str = ""
) -> dict[str, str]

Run aider in architect mode for complex multi-step tasks.

ParameterTypeDefaultDescription
fileslist[str]--File paths to include
taskstr--Complex task description
editor_modelstr""Separate editor model (defaults to architect model)

Returns: dict with keys: stdout, stderr, returncode

Raises: AiderNotInstalledError, AiderTimeoutError


AiderConfig​

Module: codomyrmex.aider.config

@dataclass
class AiderConfig:
model: str # default: os.getenv("AIDER_MODEL", "claude-sonnet-4-6")
anthropic_api_key: str # default: os.getenv("ANTHROPIC_API_KEY", "")
openai_api_key: str # default: os.getenv("OPENAI_API_KEY", "")
timeout: int # default: int(os.getenv("AIDER_TIMEOUT", "300"))

Properties​

PropertyReturn TypeDescription
has_anthropic_keyboolTrue if anthropic_api_key is non-empty
has_openai_keyboolTrue if openai_api_key is non-empty
has_any_keyboolTrue if at least one API key is set

get_config()​

Module: codomyrmex.aider.config

def get_config() -> AiderConfig

Returns a fresh AiderConfig populated from current environment variables. Each call reads env vars anew -- no caching.


get_aider_version()​

Module: codomyrmex.aider.core

def get_aider_version() -> str

Returns the installed aider version string (e.g. "aider v0.77.0"). Returns empty string "" if aider is not installed or the version check fails.

Behavior: Runs aider --version as a subprocess with a 10-second timeout. Does not raise exceptions.


Exception Hierarchy​

Module: codomyrmex.aider.exceptions

AiderError​

class AiderError(Exception)

Base exception for all aider-related errors.

AiderNotInstalledError​

class AiderNotInstalledError(AiderError)

Raised when shutil.which("aider") returns None. Message includes install instructions.

AiderTimeoutError​

class AiderTimeoutError(AiderError)

Raised when a subprocess call exceeds the configured timeout. Wraps subprocess.TimeoutExpired via raise ... from exc.

AiderAPIKeyError​

class AiderAPIKeyError(AiderError)

Raised when a required API key is missing or invalid for the selected model. Currently not raised by core module -- available for consumer use.