AgentSkillsCN

anki-connect-api

当您需要通过向本地 Anki 实例的 8765 端口发送 JSON 请求来查询牌组/卡片、在牌组间移动卡片,或管理媒体文件时,可使用 Anki-Connect 的 HTTP API。在此过程中,还需妥善处理 API 版本控制与可选的身份验证。

SKILL.md
--- frontmatter
name: anki-connect-api
description: Use when working with Anki-Connect's HTTP API to query decks/cards, move cards between decks, or manage media files by sending JSON requests to a local Anki instance on port 8765, including handling API versioning and optional authentication.

Anki-Connect API

Overview

Use this skill to build or troubleshoot Anki-Connect API calls for local Anki automation. It focuses on request/response shape, versioning, authentication, and the action-specific payloads for cards, decks, and media.

Workflow

  1. Confirm Anki is running and AnkiConnect is installed (HTTP server on port 8765).
  2. Decide whether an API key is required and include key if configured.
  3. Send a POST request with action, version, and params; always set version to 6 to keep the error field in responses.
  4. Use the relevant action reference file for the exact params and examples.

Action references

Read only the specific reference file needed to avoid loading the entire API documentation:

  • Request/response format, authentication, and sample client code: skills/anki-connect-api/references/overview.md
  • Card-related actions (find cards, card info, intervals): skills/anki-connect-api/references/card-actions.md
  • Deck-related actions (list/create/move): skills/anki-connect-api/references/deck-actions.md
  • Media actions (store/retrieve/delete media files): skills/anki-connect-api/references/media-actions.md

Quick example

json
{
    "action": "deckNames",
    "version": 6
}

POST to http://127.0.0.1:8765 and read result or error from the response.