## New Skill: transcript-fixer v1.0.0 Correct speech-to-text (ASR/STT) transcription errors through dictionary-based rules and AI-powered corrections with automatic pattern learning. **Features:** - Two-stage correction pipeline (dictionary + AI) - Automatic pattern detection and learning - Domain-specific dictionaries (general, embodied_ai, finance, medical) - SQLite-based correction repository - Team collaboration with import/export - GLM API integration for AI corrections - Cost optimization through dictionary promotion **Use cases:** - Correcting meeting notes, lecture recordings, or interview transcripts - Fixing Chinese/English homophone errors and technical terminology - Building domain-specific correction dictionaries - Improving transcript accuracy through iterative learning **Documentation:** - Complete workflow guides in references/ - SQL query templates - Troubleshooting guide - Team collaboration patterns - API setup instructions **Marketplace updates:** - Updated marketplace to v1.8.0 - Added transcript-fixer plugin (category: productivity) - Updated README.md with skill description and use cases - Updated CLAUDE.md with skill listing and counts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
117 lines
2.5 KiB
Markdown
117 lines
2.5 KiB
Markdown
# GLM API 配置指南
|
|
|
|
## API配置
|
|
|
|
### 设置环境变量
|
|
|
|
在运行脚本前,设置GLM API密钥环境变量:
|
|
|
|
```bash
|
|
# Linux/macOS
|
|
export GLM_API_KEY="your-api-key-here"
|
|
|
|
# Windows (PowerShell)
|
|
$env:GLM_API_KEY="your-api-key-here"
|
|
|
|
# Windows (CMD)
|
|
set GLM_API_KEY=your-api-key-here
|
|
```
|
|
|
|
**永久设置** (推荐):
|
|
|
|
```bash
|
|
# Linux/macOS: 添加到 ~/.bashrc 或 ~/.zshrc
|
|
echo 'export GLM_API_KEY="your-api-key-here"' >> ~/.bashrc
|
|
source ~/.bashrc
|
|
|
|
# Windows: 在系统环境变量中设置
|
|
```
|
|
|
|
### 脚本配置
|
|
|
|
脚本会自动从环境变量读取API密钥:
|
|
|
|
```python
|
|
# 脚本会检查环境变量
|
|
if "GLM_API_KEY" not in os.environ:
|
|
raise ValueError("请设置 GLM_API_KEY 环境变量")
|
|
|
|
os.environ["ANTHROPIC_BASE_URL"] = "https://open.bigmodel.cn/api/anthropic"
|
|
os.environ["ANTHROPIC_API_KEY"] = os.environ["GLM_API_KEY"]
|
|
|
|
# 模型配置
|
|
GLM_MODEL = "GLM-4.6" # 主力模型
|
|
GLM_MODEL_FAST = "GLM-4.5-Air" # 快速模型(备用)
|
|
```
|
|
|
|
## 支持的模型
|
|
|
|
| 模型名称 | 说明 | 用途 |
|
|
|---------|------|------|
|
|
| GLM-4.6 | 最强模型 | 默认使用,精度最高 |
|
|
| GLM-4.5-Air | 快速模型 | 备用,速度更快 |
|
|
|
|
**注意**: 模型名称大小写不敏感。
|
|
|
|
## API认证
|
|
|
|
智谱GLM使用Anthropic兼容API:
|
|
|
|
```python
|
|
headers = {
|
|
"anthropic-version": "2023-06-01",
|
|
"Authorization": f"Bearer {api_key}",
|
|
"content-type": "application/json"
|
|
}
|
|
```
|
|
|
|
**关键点:**
|
|
- 使用 `Authorization: Bearer` 头
|
|
- 不要使用 `x-api-key` 头
|
|
|
|
## API调用示例
|
|
|
|
```python
|
|
def call_glm_api(prompt: str) -> str:
|
|
url = "https://open.bigmodel.cn/api/anthropic/v1/messages"
|
|
headers = {
|
|
"anthropic-version": "2023-06-01",
|
|
"Authorization": f"Bearer {os.environ.get('ANTHROPIC_API_KEY')}",
|
|
"content-type": "application/json"
|
|
}
|
|
|
|
data = {
|
|
"model": "GLM-4.6",
|
|
"max_tokens": 8000,
|
|
"temperature": 0.3,
|
|
"messages": [{"role": "user", "content": prompt}]
|
|
}
|
|
|
|
response = httpx.post(url, headers=headers, json=data, timeout=60.0)
|
|
return response.json()["content"][0]["text"]
|
|
```
|
|
|
|
## 获取API密钥
|
|
|
|
1. 访问 https://open.bigmodel.cn/
|
|
2. 注册/登录账号
|
|
3. 进入API管理页面
|
|
4. 创建新的API密钥
|
|
5. 复制密钥到配置中
|
|
|
|
## 费用
|
|
|
|
参考智谱AI官方定价:
|
|
- GLM-4.6: 按token计费
|
|
- GLM-4.5-Air: 更便宜的选择
|
|
|
|
## 故障排查
|
|
|
|
### 401错误
|
|
- 检查API密钥是否正确
|
|
- 确认使用 `Authorization: Bearer` 头
|
|
|
|
### 超时错误
|
|
- 增加timeout参数
|
|
- 考虑使用GLM-4.5-Air快速模型
|