jpskill.com
📦 その他 コミュニティ

xai-grok

xAI Grok API: OpenAI-compatible at api.x.ai/v1, grok-3/grok-3-mini for fast AI reasoning

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o xai-grok.zip https://jpskill.com/download/22010.zip && unzip -o xai-grok.zip && rm xai-grok.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/22010.zip -OutFile "$d\xai-grok.zip"; Expand-Archive "$d\xai-grok.zip" -DestinationPath $d -Force; ri "$d\xai-grok.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して xai-grok.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → xai-grok フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

xai-grok

目的

このスキルは、高速なAI推論タスクのためのOpenAI互換サービスであるxAI Grok APIとの連携を可能にします。api.x.ai/v1 を介して grok-3 や grok-3-mini などのモデルへのアクセスを提供し、開発者がテキスト生成、推論などの高度なAI機能を統合できるようにします。

使用する場面

チャットボット、コード生成、データ分析など、自然言語処理を必要とするアプリケーションで迅速なAI推論が必要な場合にこのスキルを使用します。OpenAI互換ツールをすでに使用しており、特にライブカスタマーサポートや動的なコンテンツ作成のようなリアルタイムの制約があるシナリオで、より高速な応答のためにxAIの専門モデルが必要な場合は、他のAPIよりもこのスキルを選択してください。

主な機能

  • チャット補完、埋め込み、モデルストリーミングのために api.x.ai/v1 のエンドポイントにアクセスします。
  • 一般的な推論のための「grok-3」や、軽量で高速なタスクのための「grok-3-mini」などのモデルをサポートします。
  • 温度 (0.0-2.0)、最大トークン数 (最大4096)、停止シーケンスなどのパラメータを含むJSONペイロードでリクエストを処理します。
  • テキストと使用統計を含む choices 配列など、OpenAIのような応答を提供します。
  • Authorization ヘッダーに「Bearer $XAI_API_KEY」としてAPIキーを介して認証します。

使用パターン

このスキルを使用するには、環境にAPIキーを設定し(例: export XAI_API_KEY=your_key)、api.x.ai/v1 にHTTPリクエストを送信します。リクエストはJSONボディを持つPOST呼び出しとして構成します。チャットインタラクションの場合、モデルと messages 配列を指定します。コードループには常にエラーチェックを含めてください。スクリプトで使用する場合は、レート制限の再試行を処理します。非同期パターンには、応答IDでWebhookまたはポーリングを使用します。

一般的なコマンド/API

  • チャット補完のエンドポイント: POST https://api.x.ai/v1/chat/completions
    • 必須ヘッダー: Authorization: Bearer $XAI_API_KEY, Content-Type: application/json
    • 例ボディ: {"model": "grok-3", "messages": [{"role": "user", "content": "Explain quantum computing"}]}
    • CLIコマンド:
      curl -X POST -H "Authorization: Bearer $XAI_API_KEY" -H "Content-Type: application/json" -d '{"model":"grok-3","messages":[{"role":"user","content":"Summarize this text"}]}' https://api.x.ai/v1/chat/completions
  • モデル情報のエンドポイント: GET https://api.x.ai/v1/models
    • クエリパラメータ: 不要です。grok-3 や grok-3-mini などの利用可能なモデルを返します。
    • CLIコマンド:
      curl -H "Authorization: Bearer $XAI_API_KEY" https://api.x.ai/v1/models
  • リクエストの一般的なフラグ: 創造性を高めるために "temperature": 0.7 を追加したり、出力長を制限するために "max_tokens": 150 を追加したりします。
  • 設定形式: 設定をJSONファイルに保存します(例: {"api_key": "$XAI_API_KEY", "default_model": "grok-3-mini"})そしてコードでロードします。

統合に関する注意点

実行時前に $XAI_API_KEY を環境変数として設定して統合します。Pythonでは、requests ライブラリを使用します: import os; api_key = os.environ.get('XAI_API_KEY')。Node.jsでは、ヘッダー付きで fetch を使用します。キーをハードコーディングすることは避け、安全な保管庫を使用してください。リクエストをプロキシする場合は、HTTPSパススルーを確保してください。まず簡単なスクリプトでテストし、X-RateLimit-Remaining の応答ヘッダーをチェックしてレート制限を処理してください。埋め込みの場合、xAIモデルをコードベースのOpenAI形式にマッピングします。

エラー処理

HTTPステータスコードをチェックします: 無効なAPIキーの場合は401(正しい $XAI_API_KEY で再試行します); レート制限の場合は429(指数関数的バックオフを実装します。例: 5秒待ってから再試行します)。"context_length_exceeded" のようなメッセージについてはJSONエラーを解析し、それに応じて入力を切り詰めます。コードでは、リクエストを try-except ブロックで囲みます: try: response = requests.post(url, headers=headers, json=data) except requests.exceptions.RequestException as e: log_error(e) and raise。モデル固有のエラーについては、送信前にメッセージ配列が空でないことを確認するなど、入力を検証します。

具体的な使用例

  1. テキスト要約の生成: コンテンツを素早く要約するためにこれを使用します。コードスニペット:
    import requests; os.environ['XAI_API_KEY'] = 'your_key'; response = requests.post('https://api.x.ai/v1/chat/completions', headers={'Authorization': 'Bearer ' + os.environ['XAI_API_KEY']}, json={'model': 'grok-3-mini', 'messages': [{'role': 'user', 'content': 'Summarize AI ethics'}]}); print(response.json()['choices'][0]['message']['content'])
  2. 推論タスクの実行: 問題解決のためにクエリを実行します。コードスニペット:
    import requests; response = requests.post('https://api.x.ai/v1/chat/completions', headers={'Authorization': 'Bearer $XAI_API_KEY'}, json={'model': 'grok-3', 'messages': [{'role': 'user', 'content': 'Solve: What is 15% of 200?'}], 'temperature': 0.2}); print(response.json()['choices'][0]['message']['content'])

グラフの関係

  • クラスターに属する: ai-apis
  • タグ付け: ai-apis, xai
  • 埋め込みヒントによる関連付け: xai-grok (ai-apis クラスターにリンク)
📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

xai-grok

Purpose

This skill enables interaction with the xAI Grok API, an OpenAI-compatible service for fast AI reasoning tasks. It provides access to models like grok-3 and grok-3-mini via api.x.ai/v1, allowing developers to integrate advanced AI capabilities for text generation, reasoning, and more.

When to Use

Use this skill when you need quick AI inference for applications requiring natural language processing, such as chatbots, code generation, or data analysis. Opt for it over other APIs if you're already using OpenAI-compatible tools and want xAI's specialized models for faster responses, especially in scenarios with real-time constraints like live customer support or dynamic content creation.

Key Capabilities

  • Access endpoints at api.x.ai/v1 for chat completions, embeddings, and model streaming.
  • Support models like "grok-3" for general reasoning and "grok-3-mini" for lightweight, high-speed tasks.
  • Handle requests with JSON payloads, including parameters for temperature (0.0-2.0), max tokens (up to 4096), and stop sequences.
  • Provide OpenAI-like responses, including choices array with text and usage stats.
  • Authenticate via API key in the Authorization header as "Bearer $XAI_API_KEY".

Usage Patterns

To use this skill, set the API key in your environment (e.g., export XAI_API_KEY=your_key), then make HTTP requests to api.x.ai/v1. Structure requests as POST calls with JSON bodies. For chat interactions, specify the model and messages array. Always include error checking in your code loops. If using in a script, handle retries for rate limits. For asynchronous patterns, use webhooks or polling on response IDs.

Common Commands/API

  • Endpoint for chat completions: POST https://api.x.ai/v1/chat/completions
    • Required headers: Authorization: Bearer $XAI_API_KEY, Content-Type: application/json
    • Example body: {"model": "grok-3", "messages": [{"role": "user", "content": "Explain quantum computing"}]}
    • CLI command: curl -X POST -H "Authorization: Bearer $XAI_API_KEY" -H "Content-Type: application/json" -d '{"model":"grok-3","messages":[{"role":"user","content":"Summarize this text"}]}' https://api.x.ai/v1/chat/completions
  • Endpoint for model info: GET https://api.x.ai/v1/models
    • Query params: None required; returns available models like grok-3 and grok-3-mini.
    • CLI command: curl -H "Authorization: Bearer $XAI_API_KEY" https://api.x.ai/v1/models
  • Common flags in requests: Add "temperature": 0.7 for creativity, or "max_tokens": 150 to limit output length.
  • Config format: Store settings in a JSON file, e.g., {"api_key": "$XAI_API_KEY", "default_model": "grok-3-mini"} and load it in code.

Integration Notes

Integrate by setting $XAI_API_KEY as an environment variable before runtime. In Python, use requests library: import os; api_key = os.environ.get('XAI_API_KEY'). For Node.js, use fetch with headers. Avoid hardcoding keys; use secure vaults. If proxying requests, ensure HTTPS passthrough. Test with a simple script first, and handle rate limits by checking response headers for X-RateLimit-Remaining. For embedding, map xAI models to OpenAI formats in your codebase.

Error Handling

Check HTTP status codes: 401 for invalid API key (retry with correct $XAI_API_KEY); 429 for rate limits (implement exponential backoff, e.g., wait 5 seconds then retry). Parse JSON errors for messages like "context_length_exceeded" and truncate input accordingly. In code, wrap requests in try-except blocks: try: response = requests.post(url, headers=headers, json=data) except requests.exceptions.RequestException as e: log_error(e) and raise. For model-specific errors, validate inputs before sending, e.g., ensure messages array is not empty.

Concrete Usage Examples

  1. Generate a text summary: Use this to summarize content quickly. Code snippet: import requests; os.environ['XAI_API_KEY'] = 'your_key'; response = requests.post('https://api.x.ai/v1/chat/completions', headers={'Authorization': 'Bearer ' + os.environ['XAI_API_KEY']], json={'model': 'grok-3-mini', 'messages': [{'role': 'user', 'content': 'Summarize AI ethics'}]}); print(response.json()['choices'][0]['message']['content'])
  2. Perform reasoning task: Query for problem-solving. Code snippet: import requests; response = requests.post('https://api.x.ai/v1/chat/completions', headers={'Authorization': 'Bearer $XAI_API_KEY'}, json={'model': 'grok-3', 'messages': [{'role': 'user', 'content': 'Solve: What is 15% of 200?'}], 'temperature': 0.2}); print(response.json()['choices'][0]['message']['content'])

Graph Relationships

  • Belongs to cluster: ai-apis
  • Tagged with: ai-apis, xai
  • Related via embedding hint: xai-grok (links to ai-apis cluster)