AI業務活用 2026.04.19

生成AIで議事録を5分で完成させる方法【2026年版】Whisper+Claude APIで完全自動化

タグ:業務効率化 / 議事録作成 / Whisper / Claude API / 音声認識

処理の全体像

会議音声ファイル
     ↓ (Whisper API: $0.006/分)
テキスト文字起こし
     ↓ (Claude Haiku API: ~$0.003/回)
整形済み議事録
     ↓ (オプション)
Slack / メール / Notion に自動送信

Whisper + Claude APIで議事録を自動生成

# minutes_generator.py
# pip install anthropic openai pydub

import os
import anthropic
import openai
from pathlib import Path

anthropic_client = anthropic.Anthropic(api_key=os.environ["ANTHROPIC_API_KEY"])
openai_client = openai.OpenAI(api_key=os.environ["OPENAI_API_KEY"])

def transcribe_audio(audio_path: str) -> str:
    """Whisper APIで音声を文字起こしする"""
    with open(audio_path, "rb") as audio_file:
        transcript = openai_client.audio.transcriptions.create(
            model="whisper-1",
            file=audio_file,
            language="ja",  # 日本語指定で精度向上
            response_format="text",
        )
    return transcript

def generate_minutes(
    transcript: str,
    meeting_name: str,
    date: str,
    participants: list[str],
) -> str:
    """Claude Haikuで議事録を生成する"""
    
    MINUTES_PROMPT = f"""
以下の会議の文字起こしを、議事録フォーマットに整理してください。

【会議情報】
- 会議名: {meeting_name}
- 日時: {date}
- 参加者: {', '.join(participants)}

【出力形式】(このフォーマットを厳守)
## 議事録
### 日時・参加者
### 議題と議論内容
(議題ごとにH4で区切る)
### 決定事項
(箇条書き)
### アクションアイテム
| 担当者 | 内容 | 期限 |
|-------|------|------|
### 次回会議
(日時・場所・議題)

【文字起こし】
{transcript}

注意: 不明な部分は[不明]と記載。決定事項でない発言は「決定事項」に含めない。
"""
    
    response = anthropic_client.messages.create(
        model="claude-haiku-4-5-20251001",  # 議事録整形はHaikuで十分
        max_tokens=1024,
        messages=[{"role": "user", "content": MINUTES_PROMPT}]
    )
    
    return response.content[0].text

def process_meeting(
    audio_path: str,
    meeting_name: str,
    date: str,
    participants: list[str],
    output_path: str | None = None,
) -> str:
    """音声ファイルから議事録を一括生成する"""
    
    print(f"文字起こし中: {audio_path}")
    transcript = transcribe_audio(audio_path)
    print(f"文字起こし完了: {len(transcript)}文字")
    
    print("議事録を生成中...")
    minutes = generate_minutes(transcript, meeting_name, date, participants)
    
    if output_path:
        Path(output_path).write_text(minutes, encoding="utf-8")
        print(f"保存: {output_path}")
    
    return minutes

# 使用例
minutes = process_meeting(
    audio_path="meeting_2026-04-19.m4a",
    meeting_name="週次定例会議",
    date="2026年4月19日 14:00〜15:00",
    participants=["田中", "佐藤", "鈴木"],
    output_path="minutes_2026-04-19.md",
)
print(minutes)

大きなファイルを分割処理する

# chunked_transcribe.py
# 25MB以上のファイルはチャンク分割が必要

from pydub import AudioSegment
import tempfile
import os

def transcribe_large_audio(audio_path: str, chunk_minutes: int = 10) -> str:
    """25MB以上の音声ファイルを分割して文字起こしする"""
    audio = AudioSegment.from_file(audio_path)
    chunk_ms = chunk_minutes * 60 * 1000  # 分 → ミリ秒
    
    full_transcript = ""
    chunks = [audio[i:i + chunk_ms] for i in range(0, len(audio), chunk_ms)]
    
    print(f"チャンク数: {len(chunks)} ({chunk_minutes}分ずつ)")
    
    for i, chunk in enumerate(chunks):
        with tempfile.NamedTemporaryFile(suffix=".mp3", delete=False) as tmp:
            chunk.export(tmp.name, format="mp3", bitrate="64k")
            
            with open(tmp.name, "rb") as f:
                result = openai_client.audio.transcriptions.create(
                    model="whisper-1", file=f, language="ja", response_format="text"
                )
            
            os.unlink(tmp.name)
            full_transcript += result + "\n"
            print(f"チャンク {i+1}/{len(chunks)} 完了")
    
    return full_transcript

コスト試算

# cost_estimate.py
# 月100回の会議を処理するコスト

WHISPER_PER_MIN = 0.006   # $0.006/分
HAIKU_INPUT = 0.80        # $0.80/1Mトークン
HAIKU_OUTPUT = 4.00       # $4.00/1Mトークン

def estimate_cost(meeting_minutes: int, meetings_per_month: int) -> dict:
    whisper = meeting_minutes * WHISPER_PER_MIN
    # 文字起こし平均 100字/分 → 1500トークン = Claude入力約2000トークン
    haiku_input = meeting_minutes * 2000 * HAIKU_INPUT / 1_000_000
    haiku_output = 1000 * HAIKU_OUTPUT / 1_000_000  # 議事録1000トークン
    
    per_meeting = whisper + haiku_input + haiku_output
    monthly = per_meeting * meetings_per_month
    
    return {
        "per_meeting_usd": round(per_meeting, 4),
        "monthly_usd": round(monthly, 2),
        "monthly_jpy": int(monthly * 150),
    }

# 60分会議を月100回
cost = estimate_cost(60, 100)
print(f"1回あたり: ${cost['per_meeting_usd']}")
print(f"月100回: ${cost['monthly_usd']} (約{cost['monthly_jpy']}円)")
# → 1回あたり: $0.0076
# → 月100回: $0.76 (約114円)

あわせて読みたい

参考ソース