Inference-Aware Prompt Optimization for Aligning Black-Box Large Language Models