401
密钥没填全、填错或已停用。到控制台核对,复制时不要带空格。
棉花糖 API 和 OpenAI 的接口格式一样。你只需要换掉两样东西:请求地址和密钥。下面按你用的工具,一步步说清楚。
选一个,照着做完就能用。
[model_providers.mallow]
name = "Mallow API"
base_url = "https://api.mallowapi.com/v1"
env_key = "MALLOW_API_KEY"
wire_api = "responses"model_provider = "mallow"
model = "gpt-6-sol"export MALLOW_API_KEY="sk-你的密钥"
codex --profile mallowhttps://api.mallowapi.comhttps://api.mallowapi.com/v1pip install openai
export MALLOW_API_KEY="sk-你的密钥"import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["MALLOW_API_KEY"],
base_url="https://api.mallowapi.com/v1",
)
response = client.responses.create(
model="gpt-6.1-sol",
input="用一句话介绍你自己",
)
print(response.output_text)npm install openai
export MALLOW_API_KEY="sk-你的密钥"import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.MALLOW_API_KEY,
baseURL: "https://api.mallowapi.com/v1",
});
const response = await client.responses.create({
model: "gpt-6.1-sol",
input: "用一句话介绍你自己",
});
console.log(response.output_text);curl https://api.mallowapi.com/v1/responses \
-H "Authorization: Bearer $MALLOW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "gpt-6.1-sol", "input": "用一句话介绍你自己"}'先列一下模型。能返回列表,说明地址和密钥都对;再发一条消息,到控制台「使用记录」能看到这次请求,就全部完成了。
curl https://api.mallowapi.com/v1/models -H "Authorization: Bearer $MALLOW_API_KEY"密钥没填全、填错或已停用。到控制台核对,复制时不要带空格。
地址多写了路径。Base URL 只写到 /v1,Cherry Studio 只写到域名。
账户余额不够了。充值或用兑换码后会自动恢复。
这把密钥的额度用完了,或触发了频率限制。在控制台调高这把密钥的上限。
模型名要和模型列表完全一致,而且要在密钥所属的分组里。GPT 和 Grok 各用各的密钥。
发邮件到 support@mallowapi.com,附上报错信息和响应头里的 x-request-id。