К основному содержанию
скилл CX Codex

qwencloud-ops-auth — скилл для Claude Code: как установить

Настраивает авторизацию для API QwenCloud, проверяет ключи и решает ошибки 401. Пригодится при настройке DASHSCOPE_API_KEY или сбое доступа к моделям.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add QwenCloud/qwencloud-ai --skill qwencloud-ops-auth -a claude-code
Открыть на GitHub

Что делает qwencloud-ops-auth

Скилл помогает настроить переменные окружения и ключи для доступа к API QwenCloud. Он различает три типа тарифов: стандартный Pay-as-you-go с ключами sk-, Token Plan и Coding Plan с префиксом sk-sp-. Скрипты репозитория требуют обычный ключ sk-. Если передать ключ от Coding Plan на стандартный адрес, сервер вернёт ошибку 401 invalid_api_key.

Для проверки Pay-as-you-go в системе потребуется curl. В Claude Code перед первым запуском нужно прочитать SKILL.md, а Cursor загружает скилл автоматически. Скилл строго соблюдает безопасность: он никогда не выводит секреты в открытом виде и сообщает лишь статус проверки. При отсутствии ключа агент создаёт файл .env с плейсхолдером DASHSCOPE_API_KEY=sk-your-key-here, чтобы пользователь сам вставил значение.

Приоритет загрузки простой: переменная QWEN_API_KEY перекрывает DASHSCOPE_API_KEY, а системное окружение главнее локального .env. Также поддерживается подключение собственного бакета через QWEN_TMP_OSS_BUCKET.

Какие задачи решает

  • исправить ошибку 401 invalid_api_key при неверном типе ключа
  • создать шаблон .env с переменной DASHSCOPE_API_KEY
  • перенаправить запросы на адрес Token Plan или Coding Plan
  • настроить параметры собственного бакета QWEN_TMP_OSS_BUCKET

Примеры запросов агенту

  • Помоги настроить ключ для QwenCloud в файле .env
  • Почему API QwenCloud возвращает ошибку 401 invalid_api_key?
  • Проверь авторизацию через qwencloud-ops-auth

Как установить qwencloud-ops-auth

1Через Skills CLI (Vercel)

npx skills add QwenCloud/qwencloud-ai --skill qwencloud-ops-auth -a claude-code

2Вручную: положить файлы

~/.claude/skills/qwencloud-ops-auth/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/qwencloud-ops-auth/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Из того же набора9

qwencloud-vision Скилл для анализа изображений и видео через модели Qwen VL и QVQ: OCR, чтение графиков и таблиц, сравнение нескольких картинок, визуальные рассуждения. CX Codex +1 1 800установок qwencloud-video-generation Скилл генерирует и редактирует видео моделями Wan: текст в видео, оживление картинки, переход между кадрами. Пригодится, когда агенту нужно выдать готовый клип. CX Codex +1 1 600установок qwencloud-model-selector Скилл советует, какую модель Qwen взять под задачу, и подсказывает параметры. Полезен, когда неясно, что дешевле и что вообще доступно на вашем ключе. CX Codex +1 1 600установок qwencloud-text Скилл для работы с текстовыми моделями QwenCloud: генерация текста, диалоги, код и вызов функций. Пригодится, если нужно обращаться к Qwen или сторонним моделям прямо из агента. CX Codex +1 1 600установок qwencloud-update-check Скилл проверяет обновления набора qwencloud-ai через GitHub и предупреждает о выходе новой версии. Запускается вручную или вызывается другими скиллами пакета. CX Codex +1 1 600установок qwencloud-image-generation Скилл для генерации и правки изображений моделями Wan и Qwen Image прямо из агента: текст в картинку, стилизация, работа с референсами. CX Codex +1 1 600установок qwencloud-audio-tts Скилл превращает текст в речь моделями Qwen TTS: озвучка, начитки, аудио для приложений. Работает в Claude, Codex, Cursor, Copilot, Gemini CLI и OpenCode. CX Codex +1 1 600установок qwencloud-usage Скилл для работы с аккаунтом QwenCloud: вход и выход, расход токенов, биллинг, лимиты, логи вызовов и подписки. Пригодится, когда нужно узнать, почему запрос упал или сколько кредитов осталось. CX Codex +1 1 500установок

Похожие

qianwen-ops-auth QianWen-AI Скилл настраивает ключи и endpoint для QianWen API, а также помогает разбирать ошибки 401. Нужен при первом подключении или сбое авторизации. CX Codex +1 5 400установок firecrawl-build-onboarding firecrawl Скилл подтягивает учётные данные Firecrawl и настраивает SDK в проекте через встроенный браузер-аутентификатор. Используй, когда приложению нужен FIRECRAWL_API_KEY или надо добавить Firecrawl в .env. CX Codex +1 61 300установок google-cloud-recipe-auth официальный Google LLC Скилл объясняет аутентификацию и права доступа в Google Cloud. Пригодится для настройки IAM, ADC и сервисных аккаунтов в разработке и продакшене. CX Codex 15 450установок create-auth better-auth Скилл проводит агента через планирование и настройку аутентификации в TypeScript/JavaScript-проекте на Better Auth: от сканирования кода до страниц входа. CX Codex +1 13 400установок better-auth giuseppe-trisciuoglio Скилл с готовыми шаблонами Better Auth: подключение к NestJS, Drizzle ORM и PostgreSQL, вход через соцсети и плагины вроде 2FA и passkey. CX Codex +1 3 600установок configure-auth dotnet Настраивает аутентификацию и авторизацию в Blazor Web App с учётом режимов рендеринга. Помогает подружить интерактивные компоненты с ASP.NET Core Identity. CX Codex +1 3 100установок

Рядом в теме «Безопасность»

Всё по теме «Безопасность» →

Вопросы о qwencloud-ops-auth

Как установить qwencloud-ops-auth в Claude Code?

Выполните команду npx skills add QwenCloud/qwencloud-ai --skill qwencloud-ops-auth -a claude-code. Перед первым использованием Claude Code также должен прочитать файл SKILL.md.

Что делает qwencloud-ops-auth?

Скилл проверяет настройки авторизации в QwenCloud, создаёт шаблоны .env и определяет правильные адреса эндпоинтов для разных тарифов. Он защищает ключи, не показывая их в открытом виде.

Почему возникает ошибка 401 при использовании ключа Coding Plan?

Ключи Coding Plan начинаются с sk-sp- и работают только со специальным эндпоинтом. На стандартных адресах Pay-as-you-go они возвращают 401 invalid_api_key.

Исходный текст

SKILL.md · Apache-2.0
---
name: qwencloud-ops-auth
description: "Configure authentication (API keys, endpoints). TRIGGER when: setting up QWEN_API_KEY, troubleshooting 401/auth errors, when another skill reports missing credentials, or user explicitly invokes this skill by name (e.g. use qwencloud-ops-auth). DO NOT TRIGGER when: non-auth Qwen tasks, general API usage questions."
compatibility: "Requires curl for PAYG verification. Cursor: auto-loaded. Claude Code: read this skill's SKILL.md before first use."
---

# QwenCloud Authentication Setup

Configure and verify authentication for QwenCloud APIs.
This skill is part of **qwencloud/qwencloud-ai**.

## Skill directory

Use this skill's internal files for learning. Load references only when the user needs console or documentation links.

| Location | Purpose |
|----------|---------|
| `references/tokenplan.md` | Token Plan vs Coding Plan vs PAYG; CDN model catalog, endpoint mapping, pricing, User-Agent |
| `references/codingplan.md` | Coding Plan vs standard key: model list, endpoint mapping, error codes, cost risks |
| `references/custom-oss.md` | Custom OSS bucket setup for production file uploads (replaces 48h temp storage) |
| `references/sources.md` | Console URLs, auth guide (manual lookup only) |

## Security

**NEVER output any API key, OSS credential in plaintext.**
This applies equally to `DASHSCOPE_API_KEY` and custom OSS AccessKey pairs. Any check or detection of credentials in this skill must be **non-plaintext**: report only status (e.g. "set" / "not set", "valid" / "invalid", HTTP status code), never the key value.

## API Key Handling (MANDATORY)

When the API key is not configured or a script reports missing credentials:

1. **NEVER ask the user to provide their API key directly.** Do not prompt "please paste your API key" or similar. Do not request the key value in any form.
2. **Help create a `.env` file** with a placeholder, then instruct the user to fill in their own key:
   - Run: `echo 'DASHSCOPE_API_KEY=sk-your-key-here' >> .env`
   - Tell the user: "Please replace `sk-your-key-here` with your actual API key from the [QwenCloud Console](https://home.qwencloud.com/api-keys)."
3. **Or** explain how to configure the environment variable: `export DASHSCOPE_API_KEY='sk-...'` + provide the console URL.
4. **Only** write the actual key value into `.env` if the user **explicitly insists** on having the agent do it for them.

## Credential Priority Chain

Credentials are loaded in the following order (first match wins):

1. **Environment variable** — `DASHSCOPE_API_KEY` (or `QWEN_API_KEY` alias)
2. **`.env` file** — in current working directory, then repo root (detected via `.git` or `skills/` directory). Existing environment variables are not overwritten.

### Environment Variables

| Variable            | Purpose                                                                                                                                   |
|---------------------|-------------------------------------------------------------------------------------------------------------------------------------------|
| `DASHSCOPE_API_KEY` | API key (required)                                                                                                                        |
| `QWEN_API_KEY`      | Alias for `DASHSCOPE_API_KEY`. If both are set, `QWEN_API_KEY` takes priority.                                                            |
| `QWEN_BASE_URL`     | Override default endpoint (optional; for custom deployments)                                                                              |
| `QWEN_TMP_OSS_BUCKET` | Custom OSS bucket for file uploads (replaces 48h temp storage). See [custom-oss.md](references/custom-oss.md).                         |
| `QWEN_TMP_OSS_REGION` | OSS region (required when `QWEN_TMP_OSS_BUCKET` is set).                                                                              |
| `QWEN_TMP_OSS_AK_ID` / `AK_SECRET` | OSS credentials (use RAM user with least-privilege: `oss:PutObject` + `oss:GetObject`). Falls back to `OSS_ACCESS_KEY_ID` / `OSS_ACCESS_KEY_SECRET` if not set. |

## API Key Types

QwenCloud has three mutually exclusive key/plan types:

| Key Type | Format | Purpose | Endpoint |
|----------|--------|---------|----------|
| **Standard (Pay-as-you-go)** | `sk-xxxxx` | API calls from scripts, apps, and tools | `dashscope-intl.aliyuncs.com` |
| **Token Plan** | `sk-sp-xxxxx` | Interactive AI tools with User-Agent header | `token-plan.ap-southeast-1.maas.aliyuncs.com` |
| **Coding Plan** | `sk-sp-xxxxx` | Interactive AI coding tools only (Cursor, Claude Code, Qwen Code) | `coding-intl.dashscope.aliyuncs.com` |

All qwencloud/qwencloud-ai scripts require a **standard** key (`sk-`). Coding Plan keys (`sk-sp-`) produce `401 invalid_api_key` on standard endpoints. Token Plan keys (`sk-sp-`) are auto-routed to the Token Plan endpoint by scripts. Before a Token Plan request, fetch and read the current [Token Plan model catalog](https://alioth-intl.alicdn.com/skills-info/models/references/qwencloud-token-plan-models.md) and pass an exact listed model; if CDN access fails, use the [local fallback](cdn/references/qwencloud-token-plan-models.md). Coding Plan details remain in [codingplan.md](references/codingplan.md).

If the user's key starts with `sk-sp-`, first check [tokenplan.md](references/tokenplan.md) for Token Plan details and the CDN catalog above for model coverage, then [codingplan.md](references/codingplan.md) for Coding Plan specifics. Guide them to obtain a standard key from the console below if needed for models outside their plan.

### Viewing Bills

Use the **qwencloud-usage** skill to query usage, free tier quota, and billing directly. Alternatively, billing details are available in the QwenCloud console:

| Key Type | Billing Page |
|----------|--------------|
| Standard (Pay-as-you-go) | [Pay-as-you-go Billing](https://home.qwencloud.com/billing/pay-as-you-go) |
| Token Plan Personal | [Personal Billing](https://home.qwencloud.com/analytics/token-plan/individual) |
| Token Plan Team | [Team Billing](https://home.qwencloud.com/analytics/token-plan/team) |
| Coding Plan | [Coding Plan Billing](https://home.qwencloud.com/billing/coding-plan) |
| Usage analytics (both) | [Usage Analytics](https://home.qwencloud.com/analytics) |

> **NEVER fabricate, guess, or construct usage/billing/console URLs.** Only provide the exact links listed in this skill. If a URL is not listed here, do not invent one.

## Getting an API Key

1. Open the [QwenCloud Console](https://home.qwencloud.com/api-keys)
2. Sign in with your QwenCloud account
3. Create or copy an API key from the API Key management section
4. Standard keys start with `sk-` (not `sk-sp-` which is Coding Plan only)

## Security Best Practices

- **Never hardcode API keys** in source code or config files committed to version control
- **Use environment variables** or `.env` files (and add `.env` to `.gitignore`)
- **Rotate keys** periodically and revoke compromised keys immediately
- **Use least-privilege** — create dedicated keys for specific applications when possible

### Setting up `.env`

Create a `.env` file in your project root or current working directory:

```bash
echo 'DASHSCOPE_API_KEY=sk-your-key-here' >> .env
```

The script automatically loads `.env` from the current working directory and the project root (detected via `.git` or `skills/` directory). Existing environment variables are **not** overwritten by `.env` values.

### Example `.gitignore` entry

```
.env
.env.local
*.env
```

## Verification

Unless explicitly stated otherwise, any script or task mentioned in this skill runs in the **foreground** — wait for standard output; do not run it as a background task.

**PAYG only:** Test authentication with a simple curl request. **Token Plan: do not use curl; verify with the target skill's bundled Python script.**

```bash
curl -sS -X POST "https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"qwen-turbo","messages":[{"role":"user","content":"Hi"}]}'
```

A successful response returns JSON with `choices` and `message.content`.

## Authentication Error Handling

QwenCloud API keys are scoped to the QwenCloud console. An invalid or mismatched key produces `401 Unauthorized`.

### When to trigger

When **any** sub-skill receives a `401` response and a non-plaintext check shows the key is set (e.g.
`[ -n "$DASHSCOPE_API_KEY" ]`; do not output the key value).

### Probe command

For PAYG, send a lightweight request to verify authentication. In Token Plan mode, do not use curl; run the target skill's bundled Python script instead.

```bash
curl -sS -o /dev/null -w "%{http_code}" \
  -X POST "https://dashscope-intl.aliyuncs.com/compatible-mode/v1/chat/completions" \
  -H "Authorization: Bearer $DASHSCOPE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"qwen-turbo","messages":[{"role":"user","content":"hi"}]}'
```

### On 401: mandatory interactive resolution

If the PAYG probe returns 401, follow these steps **in order**:

**Step 1 — Confirm the key origin:**

```
Your API key failed authentication.

Please confirm:
1. Your key was created at home.qwencloud.com (QwenCloud console) → re-verify the key
2. My key may be invalid → create a new one at home.qwencloud.com/api-keys
```

**Step 2 — Apply the user's selection:**

| User says                         | Action                                                              |
|-----------------------------------|---------------------------------------------------------------------|
| Key is from QwenCloud console | Re-run verification to confirm the key works                        |
| Key may be invalid                | Guide user to create a new key at `home.qwencloud.com/api-keys` |

**Step 3 — Re-run verification.**

**Step 4 — If still 401**, the key itself is invalid — guide the user to create a new one from
the [QwenCloud console](https://home.qwencloud.com/api-keys).

## Validation

For PAYG, run the curl verification above. For Token Plan, run the target skill's bundled Python script instead.
Pass criteria: HTTP 200 with valid output. Save evidence to `output/qwencloud-ops-auth/`.

## Output And Evidence

- Save verification results and any diagnostic output to `output/qwencloud-ops-auth/`.
- Keep a record of successful auth tests for troubleshooting.

## Output Location

Prefer the **current working directory**. Default subdirectory: `./output/qwencloud-ops-auth/`.

**Write prohibition**: NEVER write output files into this skill's installation directory or any `skills/` hierarchy. All generated content must go to `output/` under the current working directory or a user-specified path.

## Update Check (MANDATORY Post-Execution)

When the user asks to check for updates (e.g. "check for updates", "check version", "is there a new version", "update skills"):

1. **Find qwencloud-update-check**: Look for `qwencloud-update-check/SKILL.md` in sibling skill directories.
2. **If found** — run: `python3 <qwencloud-update-check-dir>/scripts/check_update.py --print-response` and report the result. Use `--force` if the user asks to force-check.
3. **If not found** — you MUST present the following options and **wait for the user's response**:

> The update-check skill is not installed. It keeps you informed about new qwencloud/qwencloud-ai features and bug fixes.
>
> 1) **Install now** — I'll run the install command for you
> 2) **Skip for now** — do nothing this time
> 3) **Never remind me** — permanently suppress this prompt

After the user responds:
- User chooses **1** → run: `npx skills add QwenCloud/qwencloud-ai --skill qwencloud-update-check -y`, then run: `python3 <this-skill-scripts-dir>/gossamer.py --dismiss`
- User chooses **2** → run: `python3 <this-skill-scripts-dir>/gossamer.py --dismiss`, then continue normally
- User chooses **3** → run: `python3 <this-skill-scripts-dir>/gossamer.py --never-install`, then continue normally

## References

- [tokenplan.md](references/tokenplan.md) — Token Plan vs standard key; CDN model-catalog pointer, Credits billing, and endpoint guidance
- [codingplan.md](references/codingplan.md) — Coding Plan compatibility and error guidance
- [custom-oss.md](references/custom-oss.md) — Custom OSS bucket setup for production file uploads
- [sources.md](references/sources.md) — Official documentation URLs (consoles, auth guide)

© QwenCloud · Apache-2.0 · QwenCloud/qwencloud-ai

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой