import yaml

config_path = "/home/multica/.hermes/config.yaml"
api_key = "sk-cp-4PndfHCLIer0Xoh67ARXqOtTqjH76AxCeXNsBd22-ljH7H4E8LGOh6CEe9TBWuLs3oDH56t-aXYDc4bPfa5hyRUJBdYZuNeg6r5ZcvkkqY-UaRdnLRwR0lY"

with open(config_path, "r") as f:
    config = yaml.safe_load(f)

# 更新 custom_providers 中的 minimaxio
for provider in config["custom_providers"]:
    if provider["name"] == "minimaxio":
        provider["headers"] = {
            "Authorization": f"Bearer {api_key}"
        }
        # 移除 api_key_env，直接使用 headers
        if "api_key_env" in provider:
            del provider["api_key_env"]
        break

# 写回配置文件
with open(config_path, "w") as f:
    yaml.dump(config, f, default_flow_style=False, allow_unicode=True)

print("Updated minimaxio provider with Authorization header")
