開発者向け

SpeakNotes API クイックスタート

キーを作成し、サンドボックスで最初の呼び出しを行い、ライブ環境へ切り替えましょう。すべてcurlを使用した4つのステップです。

1. キーを作成する

設定からAPIキーを開き、キーを作成します。開発中はサンドボックスを選択してください。サンドボックスキーは固定の出力を返し、クレジットを消費せず、破棄可能な別のライブラリに書き込みます。

2. サンドボックスで要約する

すべてのルートはサンドボックスキーで動作します。レスポンスの形式はライブ環境と同一であるため、安心して開発を進めることができます。

curl -X POST https://api.speaknotes.io/v1/summaries \
  -H "Authorization: Bearer sn_test_YOUR_SANDBOX_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "We agreed to ship the billing fix on Friday. Sam owns the migration.",
    "styleId": "meeting-notes"
  }'

# {
#   "title": "Sandbox meeting notes",
#   "summary": "## Decisions\n- Sandbox mode confirmed working ...",
#   "styleId": "meeting-notes",
#   "creditsCharged": 0,
#   "notice": "Sandbox response: fixed output, no credits charged."
# }

3. ライブキーに切り替える

リクエストは同じで、キーだけを変更します。ライブキーは実際のモデルを実行してクレジットを消費し、レスポンスには使用量と残高が表示されます。

curl -X POST https://api.speaknotes.io/v1/summaries \
  -H "Authorization: Bearer sn_live_YOUR_LIVE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "...", "styleId": "meeting-notes"}'

# Response headers include:
#   X-Credits-Remaining: 1998
# Response body includes:
#   "creditsCharged": 2

4. ファイルをアップロードする

長いメディアはバックグラウンドで処理されます。アップロードを作成し、署名付きURLにファイルをPUTし、完了マークを付け、ステータスが「完了」になるまでノートをポーリングします。

# 1. create the note and get a signed upload URL
curl -X POST https://api.speaknotes.io/v1/uploads \
  -H "Authorization: Bearer $SPEAKNOTES_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"fileName": "standup.m4a", "contentType": "audio/mp4", "styleId": "meeting-notes"}'

# 2. upload the file straight to the signed URL
curl -X PUT "$UPLOAD_URL" -H "Content-Type: audio/mp4" --data-binary @standup.m4a

# 3. tell SpeakNotes the upload finished (this is where credits are charged)
curl -X POST https://api.speaknotes.io/v1/uploads/$NOTE_ID/complete \
  -H "Authorization: Bearer $SPEAKNOTES_API_KEY"

# 4. poll until status is Done, then read the note
curl https://api.speaknotes.io/v1/notes/$NOTE_ID/status \
  -H "Authorization: Bearer $SPEAKNOTES_API_KEY"

curl https://api.speaknotes.io/v1/notes/$NOTE_ID \
  -H "Authorization: Bearer $SPEAKNOTES_API_KEY"

APIの探索

GET /v1 は認証情報を必要とせず、リソース、スコープ、レート制限、クレジットコスト、認証方法を返します。エージェントが自身を構成するための最も迅速な方法です。

curl https://api.speaknotes.io/v1

# Returns the resources, scopes, rate limits, credit costs,
# and how to authenticate. No credential required.

次は、認証とスコープ、エラーコード、および各操作のコストについて説明します。