-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Comments
没改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)
'''' |
各位大佬帮忙看看,为什么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 |
我自己去官网搞的api不会报这个错,但是就是说没额度,但是申请了免费的api报错如下,请问大佬如何解决,如果能用,后续会考虑付费使用![image](https://private-user-images.githubusercontent.com/150574868/402857135-1803c10c-659e-404b-b3b8-b8a67e493762.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1MTYxOTksIm5iZiI6MTczOTUxNTg5OSwicGF0aCI6Ii8xNTA1NzQ4NjgvNDAyODU3MTM1LTE4MDNjMTBjLTY1OWUtNDA0Yi1iM2I4LWI4YTY3ZTQ5Mzc2Mi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE0JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNFQwNjUxMzlaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00YmRlMDk1YTM4YTMwMDZiZmMzNzUwMTczNDgzYmU3NzlmZGRkZWJjYmY4ZjM2NzcwNTA1M2JkZjdkNjM0MDIwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.dJGUAEBMsBUY35zYgHleu23Mglmfqv5BUeB8HjctKNY)
The text was updated successfully, but these errors were encountered: