...istdir(INPUT_DIR):
    if not fn.endswith(".txt"):
        continue

    in_path = os.path.join(INPUT_DIR, fn)
    out_path = os.path.join(OUTPUT_DIR, fn.replace(".txt", "_analysis.txt"))

    print("Analysiere:", fn)

    with open(in_path, "r", encoding="utf-8", errors="replace") as f:
        text = f.read()

    result = call_llm(text)

    with open(out_path, "w", encoding="utf-8") as out:
        out....