fix: Add anthropic-beta header and correct field name for skill uploads

Fixes #182

Changes:
- Add 'anthropic-beta: skills-2025-10-02' header (required by Anthropic Skills API)
- Change multipart field name from 'skill' to 'files[]' (correct API format)

Without these fixes, all upload attempts returned 404 errors.

Verified:
- All 379 tests passing (100%)
- No regressions in test suite
- Upload functionality corrected per API requirements

Co-authored-by: Straughter "BatmanOsama" Guthrie <straughterguthrie@gmail.com>
Original PR: #183
This commit is contained in:
yusyus
2025-11-11 23:39:56 +03:00
parent 5ee07a2181
commit 4cbd0a0a3c

View File

@@ -74,7 +74,8 @@ def upload_skill_api(zip_path):
api_url = "https://api.anthropic.com/v1/skills"
headers = {
"x-api-key": api_key,
"anthropic-version": "2023-06-01"
"anthropic-version": "2023-06-01",
"anthropic-beta": "skills-2025-10-02"
}
try:
@@ -86,7 +87,7 @@ def upload_skill_api(zip_path):
print("⏳ Uploading to Anthropic API...")
files = {
'skill': (zip_path.name, zip_data, 'application/zip')
'files[]': (zip_path.name, zip_data, 'application/zip')
}
response = requests.post(