Steam Trends API について
Steam Trends APIは、Steamゲームへの関心を分析する開発者向けのAPIとPython SDKです。Steam Web APIキーなしで、月次履歴、成長率、リアルタイムランキングを取得できます。
主な機能
- 01月次トレンド系列の取得
- 02複数期間の成長率計算
- 03リアルタイム人気ゲームランキング
- 04同期・非同期Pythonクライアント
活用シーン
- 01期間ごとのゲーム関心度の比較
- 02現在のSteam人気ゲームの確認
- 03トレンドデータのPandas形式への整理
設定
リモートサーバーはインストール不要です。クライアントを選んで設定をコピーするか、ワンクリックで導入できます。
https://steam.api.trendsapi.ai/mcpclaude mcp add --transport http ai-trendsapi-steam https://steam.api.trendsapi.ai/mcp{"mcpServers":{"ai-trendsapi-steam":{"type":"http","url":"https://steam.api.trendsapi.ai/mcp"}}}Cursor で開く{"servers":{"ai-trendsapi-steam":{"type":"http","url":"https://steam.api.trendsapi.ai/mcp"}}}VS Code で開く{"mcpServers":{"ai-trendsapi-steam":{"type":"http","url":"https://steam.api.trendsapi.ai/mcp"}}}{"mcpServers":{"ai-trendsapi-steam":{"serverUrl":"https://steam.api.trendsapi.ai/mcp"}}}コマンドはターミナルで実行し、JSON は各クライアントの MCP 設定に貼り付けて再起動します。認可が必要なサーバーは初回接続時にログインを求めます。
https://steam.api.trendsapi.ai/mcp認証が必要ツール
詳細
Steam 同時プレイヤー API
Trends API による Steam のプレイヤー関心度の推移です。月次 CCU 履歴、成長率、現在の最多プレイタイトルを確認できます。Steam Web API キーは不要です。
キー:trendsapi.ai/#get-key。HTTP の仕様とすべてのソース:trendsapi-ai/trendsapi。
認証
pip install trendsapi-steam
export TRENDSAPI_KEY=your_key
Python 3.9 以降。同じキーを HTTP API と共有します。
from trendsapi_steam import TrendsAPI
client = TrendsAPI() # TRENDSAPI_KEY
# client = TrendsAPI(api_key="YOUR_KEY")
キーワード用ヘルパーのデフォルトは source: "steam" です。同じクライアントで他のプラットフォームを利用する場合は、source= を指定します。すべてのソースに対応した公式フルクライアント(プリセットなし):trendsapi。
メソッド
| メソッド | REST の mode | 戻り値 |
|---|---|---|
get_time_series(keyword, source=, data_mode=) | get_time_series | list[TrendsDataPoint] |
get_growth(keyword, percent_growth=, source=, data_mode=) | get_growth | GetGrowthResponse |
get_live(limit=, offset=, category=) | get_top_trends | GetTopTrendsResponse |
get_top_trends(type=, ...) | get_top_trends | GetTopTrendsResponse |
source は小文字(steam)です。type は正確な表記(Steam Most Played)を使います。両方を混在させると 400 エラーになります。
from trendsapi_steam import TrendsAPI
client = TrendsAPI() # TRENDSAPI_KEY
# client = TrendsAPI(api_key="YOUR_KEY")
series = client.get_time_series("counter-strike 2")
print(series[-1].date, series[-1].value)
growth = client.get_growth("counter-strike 2", percent_growth=["3M", "12M"])
print(growth.results[0].growth, growth.results[0].direction)
hot = client.get_live(limit=10)
print(hot.data) # [[1, "..."], ...]
get_time_series
points = client.get_time_series("counter-strike 2")
各データポイント:
| フィールド | 常に含まれる | 意味 |
|---|---|---|
date | はい | YYYY-MM-DD |
value | はい | この系列の 0〜100 の指数 |
keyword | はい | エコー |
volume | いいえ | 利用可能な場合の絶対ボリューム |
source または datatype | いいえ | パイプラインのラベル |
Python は list[TrendsDataPoint] を返します。["date"] ではなく .date と .value を使用してください。
JS は同じフィールドをオブジェクトのプロパティとして返します。
get_growth
g = client.get_growth("counter-strike 2", percent_growth=["12M", "3M", "YTD"])
print(g.results[0].growth, g.results[0].direction)
percent_growth のデフォルトは ["12M"] です。プリセット:7D 14D 30D 1M 2M 3M 6M 9M 12M/1Y 18M 24M/2Y 36M/3Y 48M 60M/5Y MTD QTD YTD。カスタム指定:{"name": "Launch", "recent": "2024-06-01", "baseline": "2024-01-01"}。
| フィールド | 意味 |
|---|---|
search_term | キーワード |
data_source | ソース |
results | 各期間につき 1 つのオブジェクト(period、growth、direction、日付、値) |
metadata | 件数/成功フラグ |
複数の期間を指定しても、リクエスト数は 1 回です。Python:growth.results[0].growth。JS:growth.results[0].growth。
get_live
hot = client.get_live(limit=10)
| フィールド | 意味 |
|---|---|
as_of_ts | スナップショットの時刻 |
type | フィード名 |
limit、offset、count | ページネーション |
data | [rank, label] の行 |
Python:hot.data。JS:hot.data。任意で offset= と category= を指定できます(Amazon Best Sellers by Category、Top Websites のみ)。
非同期
import asyncio
from trendsapi_steam import AsyncTrendsAPI
async def main():
c = AsyncTrendsAPI()
return await asyncio.gather(
c.get_time_series("counter-strike 2"),
c.get_time_series("counter-strike 2", source="google search"),
)
asyncio.run(main())
200 の応答 1 件につき、課金対象のリクエスト 1 回となります。
Pandas
from dataclasses import asdict
import pandas as pd
from trendsapi_steam import TrendsAPI
df = pd.DataFrame(asdict(p) for p in TrendsAPI().get_time_series("counter-strike 2"))
df["date"] = pd.to_datetime(df["date"])
print(df.set_index("date")["value"].resample("ME").mean().tail())
呼び出し(curl)
| フィールド | 値 |
|---|---|
| エンドポイント | POST https://api.trendsapi.ai/api |
| 認証 | Authorization: Bearer $TRENDSAPI_KEY |
| 履歴 | get_time_series または get_growth で source: steam を指定 |
| キーワード | ゲームの表示名。例:counter-strike 2 |
ライブの type | Steam Most Played |
curl -sS -X POST https://api.trendsapi.ai/api \
-H "Authorization: Bearer $TRENDSAPI_KEY" \
-H "Content-Type: application/json" \
-d '{"mode":"get_time_series","source":"steam","keyword":"counter-strike 2"}'
ソースに関する注意
- バックエンドは Steam ストア検索を使って名前を解決します。AppID はリクエストフィールドではありません。
- 系列は月次です。
valueはそのタイトルに対する 0〜100 の値で、生の CCU ではありません。 type: steamは 400 エラーになります。
エラー
| HTTP | クライアント |
|---|---|
| 200 | ペイロードを解析します。Python のデータクラス/JS の型付きオブジェクト |
| 400 | 例外を発生させます。source または type の表記を修正してください |
| 401 | 例外を発生させます。TRENDSAPI_KEY を確認してください |
| 404 | 例外を発生させます。そのキーワードの系列はありません。再試行しないでください |
| 429 | 例外を発生させます。クォータ超過です |
| 5xx | クライアントが再試行した後、例外を発生させます |
HTTP の body フィールドは JSON 文字列です。SDK はこれをデコードします。生の curl では、body をもう一度解析する必要があります。
サイト:https://trendsapi.ai/trends/steam-trends。
ライセンス
MIT。LICENSE を参照してください。
コメント
AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。