Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

免费的api报错 #351

Open
xulw8 opened this issue Jan 14, 2025 · 5 comments
Open

免费的api报错 #351

xulw8 opened this issue Jan 14, 2025 · 5 comments

Comments

@xulw8
Copy link

xulw8 commented Jan 14, 2025

我自己去官网搞的api不会报这个错,但是就是说没额度,但是申请了免费的api报错如下,请问大佬如何解决,如果能用,后续会考虑付费使用image

@ynpl
Copy link

ynpl commented Jan 15, 2025

没改api地址 转发api要修改api地址的哦

from openai import OpenAI

client = OpenAI(
    # 输入转发API Key
    api_key="sk-xxxxxxx",
    base_url="https://api.chatanywhere.tech/v1"
)

completion = client.chat.completions.create(
    model="gpt-3.5-turbo-1106",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "你是谁!"}
    ],
    logprobs=True,
    
    stream=True  # 是否开启流式输出
)

# 非流式输出获取结果
# print(completion.choices[0].message)
# 流式输出获取结果
for chunk in completion:
    print(chunk.choices[0].delta)
''''

@jayzheng999
Copy link

Image

内测免费API似乎连不上主机

@ynpl
Copy link

ynpl commented Feb 1, 2025

Image

内测免费API似乎连不上主机

你这报错非api报错, 请检查自己的网络和设置. org是国外的如果你是国内的用.tech 还有不确定你使用的软件后面是否需要添加/v1,可以观看一下你使用的软件的文档

@2002621
Copy link

2002621 commented Feb 7, 2025

各位大佬帮忙看看,为什么AskPDF不能用,总是报错

HTTP POST https://api.chatanywhere.tech/v1/chat/completions failed with status code 403:

{“error”:{“message”:“免费API限制模型输入token小于4096,如有更多需求,请访问 https://api.chatanywhere.tech/#/shop 购买付费API。The number of prompt tokens for free accounts is limited to 4096. If you have additional requirements, please visit https://api.chatanywhere.tech/#/shop to purchase a premium key.”,“type”:“chatanywhere_error”,“param”:null,“code”:“403 FORBIDDEN”}}

如果是网络问题,请优化网络环境,其它问题请截图寻求开发者帮助。
显示这个报错代码

@ynpl
Copy link

ynpl commented Feb 8, 2025

各位大佬帮忙看看,为什么AskPDF不能用,总是报错

HTTP POST https://api.chatanywhere.tech/v1/chat/completions failed with status code 403:

{“error”:{“message”:“免费API限制模型输入token小于4096,如有更多需求,请访问 https://api.chatanywhere.tech/#/shop 购买付费API。The number of prompt tokens for free accounts is limited to 4096. If you have additional requirements, please visit https://api.chatanywhere.tech/#/shop to purchase a premium key.”,“type”:“chatanywhere_error”,“param”:null,“code”:“403 FORBIDDEN”}}

如果是网络问题,请优化网络环境,其它问题请截图寻求开发者帮助。 显示这个报错代码

文章太长了 免费的api单次请求最多就4096token, 你可以购买付费的或者选择文章一段,然后用selection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants