Amsc Mag logo

Amsc Mag

Organization
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.

Overview

PublisherAI-ModCon
Repositorygenesis-skills
Skill nameamsc-mag
Stars
37
Forks
16
Bundled files
2
LicenseBSD-2-Clause
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 2 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by AI-ModCon on GitHub. Read the source before you install it.

Installation

Install the Amsc Mag AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/AI-ModCon/genesis-skills/tree/main/skills/amsc-skills/amsc-mag
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

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
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Amsc Mag in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Amsc Mag on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Amsc Mag is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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.

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Amsc Mag AI skill do?

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.

Why use Amsc Mag on TypingMind?

Because you install it once and use it with any model. Amsc Mag is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Amsc Mag in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/AI-ModCon/genesis-skills/tree/main/skills/amsc-skills/amsc-mag. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Amsc Mag?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Amsc Mag?

As many as you like. As long as a model supports skills, you can use Amsc Mag with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Amsc Mag AI skill free?

Yes. It is published on GitHub by AI-ModCon under the BSD-2-Clause license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇