Logo Amsc Mag

Amsc Mag

Tổ chức
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.

Tổng quan

Nhà phát hànhAI-ModCon
Kho mãgenesis-skills
Tên kỹ năngamsc-mag
Sao
37
Bản fork
16
Tệp đi kèm
2
Giấy phépBSD-2-Clause
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 2 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được AI-ModCon công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Amsc Mag trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/AI-ModCon/genesis-skills/tree/main/skills/amsc-skills/amsc-mag
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân 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
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Amsc Mag trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Amsc Mag ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Amsc Mag với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

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.

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Amsc Mag làm được gì?

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.

Vì sao nên dùng Amsc Mag trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Amsc Mag là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Amsc Mag trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/AI-ModCon/genesis-skills/tree/main/skills/amsc-skills/amsc-mag. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Amsc Mag?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Amsc Mag với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Amsc Mag với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Amsc Mag có miễn phí không?

Có. Kỹ năng này được AI-ModCon phát hành trên GitHub theo giấy phép BSD-2-Clause. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇