Amsc Magのロゴ

Amsc Mag

組織
AI-ModCon
amsc-mag

Use this skill to work with the AmSC Model Access Gateway (MAG) at mag.genesis.americansciencecloud.org, the official OpenAI- and Anthropic-compatible LLM endpoint for American Science Cloud. Covers PAT authentication, model discovery and selection, model-string syntax (provider, effort, flex, compression), chat completions, embeddings, budget/429/401 troubleshooting, Claude Code setup (claude-amsc), and LangChain. Trigger on MAG, Model Access Gateway, AmSC LLM, AMSC_TOKEN, i2 API migration, or Claude Code with AmSC.

概要

公開者AI-ModCon
リポジトリgenesis-skills
スキル名amsc-mag
スター
37
フォーク
16
同梱ファイル
2
ライセンスBSD-2-Clause
リンク
  • Markdown形式の指示

    モデルが必要に応じて読み込むSKILL.mdファイルです。関連するリクエストがあったときだけトークンを消費します。

  • どのLLMでも利用可能

    AIスキルはプロバイダー固有のコードではなく、通常のMarkdownなので、GPT、Claude、Gemini、Grok、ローカルモデルで利用できます。

  • 2個の同梱ファイル

    モデルが作業中に読み取れるスクリプト、テンプレート、参考資料です。ファイルは読み取り専用で、実行されることはありません。

  • オープンソース

    AI-ModConがGitHubで公開しています。インストールする前にソースを確認してください。

インストール

AIスキル「Amsc Mag」をTypingMindにインストールすれば、どのLLMでも利用できます。SKILL.mdを読み取れる別のAIエージェントに追加することもできます。

1

TypingMindにインストール

TypingMindはGitHubフォルダから直接スキルをインストールします。SKILL.mdを読み取り、リソースファイルをまとめてローカルに保存します。

  1. アプリを開き、「プラグイン」→「スキル」に移動します。
  2. 「GitHubからインストール」を選択します。
  3. 以下のスキルフォルダのURLを貼り付けて確定します。
    https://github.com/AI-ModCon/genesis-skills/tree/main/skills/amsc-skills/amsc-mag
  4. スキルを利用したいチャットごとに、そのスキルを有効にしてください。
「プラグイン」→「スキル」→「スキルを追加」→「GitHubのURLから」を選択し、フォルダのURLを貼り付けて「続行」を押します。
2

別のAIエージェントにインストール

Agent Skills形式を読み取れるAIエージェントなら、このスキルを利用できます。フォルダをそのAIエージェントのスキルディレクトリにコピーしてください。

Claude Code — .claude/skills
git clone --depth 1 https://github.com/AI-ModCon/genesis-skills.git /tmp/genesis-skills
mkdir -p .claude/skills
cp -r /tmp/genesis-skills/skills/amsc-skills/amsc-mag .claude/skills/amsc-mag
コピー後、新しいスキルを読み込むためにClaude Codeを再起動してください。

TypingMindで使用

TypingMindのチャットでAmsc Magを有効にするだけで、あとはモデルが対応します。名前と説明がシステムプロンプトに含まれ、関連するリクエストがあると、モデルが指示の全文を自動で読み込みます。手動で呼び出す必要はなく、実際に使用されるまでトークンを消費しません。

関連するリクエストがあるとすぐに、モデルが自動的にAmsc Magを読み込みます。

どのAIモデルでも利用可能

AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、Amsc Magは作成時に想定されたモデルに縛られません。TypingMindに一度インストールすれば、ご自身のAPIキーを使って、GPT-5、Claude、Gemini、Grok、DeepSeek、Mistral、Llama、またはご自身で実行するローカルモデルで利用できます。

  • 必要なときだけ読み込み

    システムプロンプトには名前と説明だけが含まれます。関連するリクエストが初めてあったときに指示を取得するため、スキルを使わない間は指示の読み込みにトークンを消費しません。

  • チャットの途中でモデルを切り替え

    スキルはコードではなく指示なので、モデルを切り替えてもそのまま使えます。次のモデルも同じSKILL.mdを読み込みます。

スキルの指示

モデルが読み込むSKILL.mdの内容です。スキルはモデルが従う指示なので、インストールする前に確認してください。

AmSC Model Access Gateway (MAG)

Base URL: https://mag.genesis.americansciencecloud.org (Swagger/docs at the same URL). OpenAI-compatible: GET /v1/models, POST /v1/chat/completions, POST /v1/embeddings. Anthropic-compatible for Claude Code via ANTHROPIC_BASE_URL.

This replaces the deprecated legacy i2-api (see the i2-api skill for migration).

Prerequisites

  1. You need an approved Genesis Mission project with a MAG allocation.
  2. Go to https://my.amsc.energy.gov/dashboard -> your project -> Personal Access Tokens -> Generate PAT.
  3. The PAT is shown once and is short-lived. Export it for the current session, or keep it in a non-versioned secrets file you source on demand:
bash
export AMSC_TOKEN=<your-pat>
  1. When the PAT expires the MAG returns 401; generate a new one.

Never hardcode or commit the token. Scripts read it from AMSC_TOKEN, fail if unset, and never print it.

Quick Start

bash
python3 scripts/mag.py list-models
python3 scripts/mag.py chat --model claude-sonnet --message "Hello, world"

Scripts are stdlib-only.

Model Strings

Format: <base>[:<mod>]...[@<provider>]

  • Providers (company buckets): openai, amazon (Bedrock: Claude, Llama, Nova, gpt-oss, ...), google (Vertex Gemini), microsoft (Azure).
  • Effort: none|minimal|low|medium|high|xhigh|max. Service tier: flex. Compression: compact|compressed|nocompress.
  • gpt-5.4:high:flex@openai is identical to gpt-5.4-high-flex@openai. The dashed form exists for backward compatibility with CBorg clients; prefer the : syntax.
  • A model's accepted modifiers are shown on the MAG Dashboard Models tab; an invalid one returns 400 amsc_invalid_model_modifier.
  • Bare names (claude-opus, claude-sonnet, claude-haiku, gemini-flash) are aliases. They are mutable: the underlying model version can change without notice. Clients that require a specific version should use a model string with the version number. A bare name pins to one deployment per key for about an hour (not round-robin). Use @provider for a hard provider guarantee.
  • Legacy hyphen suffixes and cborg path prefixes (openai/, bedrock/, aws/, vertex_ai/, gemini/, azure/) are accepted but not listed. anthropic/ returns 404.
  • Always query GET /v1/models for the live list. Do not hardcode model availability.

Routing Headers

HeaderValue
X-AmSC-MAG-Providersame as @provider (model string wins)
X-AmSC-MAG-Efforteffort level
X-AmSC-MAG-Service-Tierflex or standard
X-AmSC-MAG-Compressioncompact, compressed, off
  • An unusable header value is ignored (fail-soft). An unusable modifier in the model string is a 400 amsc_invalid_model_modifier.
  • The response header X-AmSC-MAG-Applied states what was actually served (provider, effort, tier, compression). Read it to confirm. mag.py chat prints it to stderr.
bash
python3 scripts/mag.py chat --model gpt-5.4 --provider openai \
  --effort high --service-tier flex --message "Summarize ..."

Model Discovery and Selection

bash
python3 scripts/mag.py list-models          # model ids
python3 scripts/mag.py list-models --json   # full metadata

To compare capabilities, prices and accepted modifiers, use the Models tab of the MAG Dashboard (https://mag.genesis.americansciencecloud.org/dashboard/).

Chat and Embeddings

bash
python3 scripts/mag.py chat --model claude-sonnet --system "Be concise." \
  --message "Explain quantum entanglement" --stream --max-retries 3
python3 scripts/mag.py embed --model <embedding-model-id> --input "Sample text"

Reasoning models spend reasoning tokens out of max_completion_tokens. Use at least about 2000 or the content may come back empty.

Flex and Compression

  • Flex: always 50% off, queued, 15-minute timeout; do not use on interactive paths. Availability is not guaranteed and a request may return 429, so the client must adapt (retry later or fall back to standard). Only some models support it (OpenAI-served GPT, Vertex Gemini flash). Bedrock has none.
  • Compression: opt-in per request. :compact is the lossless profile; :compressed is aggressive. compressed preserves code blocks verbatim but drops low-information tokens in free-form prose, so do not use it when the model must edit or reproduce text verbatim (drafting a paper or documentation). Compression fails open, applies to chat only, and never to embeddings. Confirm what was applied in X-AmSC-MAG-Applied.

Benchmarking and Reproducibility

Compression is off by default today, but the default may change. Clients that need exact fidelity or reproducible results (model benchmarks, regression suites, prompt comparisons) must not rely on the default:

  • Disable compression explicitly: append :nocompress to the model string or send X-AmSC-MAG-Compression: off.
  • Pin the model version with a versioned model string, not a bare alias (aliases are mutable).
  • Pin the provider (@provider) so the same deployment family serves every run.
  • Do not use flex for timed benchmarks; latency and availability vary.
  • Record X-AmSC-MAG-Applied with each result to prove what was served.
bash
python3 scripts/mag.py chat --model <versioned-model-id>:nocompress@<provider> --message "..."

Limits and Errors

  • Budgets are rolling per month, per-user and per-project, plus VO allocation limits. Monitor spend on the MAG dashboard.
  • 429 has three causes: an exhausted budget window, per-user request-rate or concurrency limits (reduce parallel requests and back off), or provider throttling. Read the response body.
  • 401 means an expired or invalid PAT: generate a new one.
  • Limits: 120 requests per minute, no TPM cap, 5 parallel requests. Contact AmSC MAG support to request an increase.
  • Timeouts: raise --timeout for long generations. Corporate TLS inspection: point SSL_CERT_FILE / REQUESTS_CA_BUNDLE (Python) or NODE_EXTRA_CA_CERTS (Node) at your CA bundle.

Claude Code

Add the claude-amsc shell function from references/claude-amsc.sh to ~/.zshrc or ~/.bashrc:

bash
source /path/to/amsc-mag/references/claude-amsc.sh
claude-amsc

The variables are set only for that invocation, so plain claude is unaffected. Do not set ANTHROPIC_MODEL, ANTHROPIC_DEFAULT_*_MODEL, or CLAUDE_CODE_SUBAGENT_MODEL; switch models with /model. For Haiku run CLAUDE_CODE_AUTO_COMPACT_WINDOW=100000 claude-amsc or /autocompact 100000. To pin a provider, run MAG_PROVIDER=amazon claude-amsc (opt-in; sends X-AmSC-MAG-Provider).

LangChain / OpenAI SDK

python
import os
from langchain_openai import ChatOpenAI

llm = ChatOpenAI(
    model="claude-sonnet",
    base_url="https://mag.genesis.americansciencecloud.org/v1",
    api_key=os.environ["AMSC_TOKEN"],
    max_retries=3,
    timeout=600,
    default_headers={"X-AmSC-MAG-Provider": "amazon"},  # optional
)
print(llm.invoke("Explain quantum entanglement").content)

OpenAIEmbeddings takes the same base_url and api_key.

同梱ファイル

スキルが読み込まれている間、モデルは必要に応じてこれらを読み取ります。読み取り可能なファイルとして提供され、実行されることはありません。

よくある質問

AIスキル「Amsc Mag」では何ができますか?

Use this skill to work with the AmSC Model Access Gateway (MAG) at mag.genesis.americansciencecloud.org, the official OpenAI- and Anthropic-compatible LLM endpoint for American Science Cloud. Covers PAT authentication, model discovery and selection, model-string syntax (provider, effort, flex, compression), chat completions, embeddings, budget/429/401 troubleshooting, Claude Code setup (claude-amsc), and LangChain. Trigger on MAG, Model Access Gateway, AmSC LLM, AMSC_TOKEN, i2 API migration, or Claude Code with AmSC.

TypingMindでAmsc Magを使うメリットは何ですか?

一度インストールすれば、どのモデルでも使えるからです。Amsc Magはプロバイダー固有のコードではなく、通常のMarkdownで記述されているため、同じスキルをGPT-5、Claude、Gemini、Grok、ローカルモデルで利用できます。チャットの途中でモデルを切り替えても、そのまま使い続けられます。TypingMindは自分のAPIキーで動作するため、シート単位のサブスクリプションではなく、プロバイダーに直接料金を支払います。スキルとチャットは自分のストレージに保持されます。

TypingMindにAmsc Magをインストールするにはどうすればよいですか?

TypingMindで「プラグイン」→「スキル」→「GitHubからインストール」を開き、https://github.com/AI-ModCon/genesis-skills/tree/main/skills/amsc-skills/amsc-magを貼り付けてください。TypingMindがSKILL.mdを読み込み、関連ファイルをまとめて、チャットごとに有効にできるスキルとしてインストールします。

Amsc Magを使えるAIモデルはどれですか?

TypingMindに接続したどのモデルでも利用できます。AIスキルはプロバイダー固有のコードではなく、通常のMarkdownで書かれた指示です。そのため、GPT、Claude、Gemini、Grok、ローカルモデルのいずれも、リクエストの内容がこのスキルの用途に合ったときに、このスキルを読み込めます。

Amsc Magで使えるAIモデルの数に制限はありますか?

数に制限はありません。スキルに対応したモデルであれば、GPT、Claude、Gemini、Grok、DeepSeek、Mistral、Llamaなど、どのモデルでもAmsc Magを利用できます。すべてTypingMind上で、自分のAPIキーを使って利用できます。

AIスキル「Amsc Mag」は無料ですか?

はい。AI-ModConがBSD-2-ClauseライセンスのもとでGitHubに公開しています。ご利用のAIプロバイダーに支払うのは、使用したトークンの料金だけです。

AIスキルとは何ですか?

AIスキルは、特定のタスクの実行方法をAIモデルに教える、再利用可能な指示のセットです。オープンなAgent Skills形式に従い、名前と説明を含むSKILL.mdファイルに加え、モデルが必要とするスクリプト、テンプレート、参照ファイルで構成されます。モデルはリクエストがスキルに合致したときだけ指示を読み込むため、インストール済みのスキルも、使うまでは費用がかかりません。

AIスキルは、プラグインやMCPサーバーとどう違いますか?

プラグインやMCPサーバーは、モデルが呼び出せる新しいツールを提供します。ツールとは、どこかで実行され、結果を返すコードです。一方、AIスキルは、タスクへの取り組み方、従うべき手順、望ましい出力の例といった知識や進め方をモデルに伝えます。スキルは通常のMarkdownで記述されているため、サーバー、APIキー、実行環境は不要で、どのモデルでも利用できます。

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇