此贴主要适合小白服用,本人是一个对这个领域比较陌生的小白,我正在学习并尝试使用一些工具和技术,但是在某些方面可能还有些困惑和不足,我希望大家能够理解我的处境,并且给予一些指导和建议,帮助我更好地学习和成长。非常感谢您的帮助和支持!
cURL中的参数还请点击下方的 官方文档 跳转了解具体可修改值,只能帮到这里了,想上传GIF结果不支持,第三方图库我了解到的,不想以后没图看,故没有上传
用到的 access token 我白嫖的 DoneWell 佬友的,没有access token 就不需要往下看了
API接口
-
图片生成:
https://api.oaifree.com/v1/images/generations
对应官方https://api.openai.com/v1/images/generations
文档在:https://platform.openai.com/docs/api-reference/images/create -
图片编辑:
https://api.oaifree.com/v1/images/edits
对应官方https://api.openai.com/v1/images/edits
文档在:https://platform.openai.com/docs/api-reference/images/createEdit -
对话:
https://api.oaifree.com/v1/chat/completions
对应官方:https://api.openai.com/v1/chat/completions
文档在:https://platform.openai.com/docs/api-reference/chat -
语音合成:
https://api.oaifree.com/v1/audio/speech
对应官方https://api.openai.com/v1/audio/speech
文档在:https://platform.openai.com/docs/api-reference/audio/createSpeech -
语音转录:
https://api.oaifree.com/v1/audio/transcriptions
对应官方https://api.openai.com/v1/audio/transcriptions
文档在:https://platform.openai.com/docs/api-reference/audio/createTranscription
cRUl 示例
生图
curl --request POST \
--url https://api.oaifree.com/v1/images/generations \
--header 'Authorization: Bearer your_ access token' \
--header 'content-type: application/json' \
--data '{
"model": "dall-e-3",
"prompt": "Your Name Poster",
"n": 2,
"size": "1792x1024"
}'
修图
curl --request POST \
--url https://api.oaifree.com/v1/images/edits \
--header 'Authorization: Bearer your_ access token' \
--header 'content-type: multipart/form-data' \
--form image=@image \
--form mask=@mask \
--form 'prompt="Modify its eyes to bud"' \
--form n=2 \
--form 'size="1024x1024"'
对话
curl --request POST \
--url https://api.oaifree.com/v1/chat/completions \
--header 'Authorization: Bearer your_ access token' \
--header 'content-type: application/json' \
--data '{
"model": "gpt-4",
"messages": [
{
"role": "system",
"content": "我想问你你是否知道linux.do这个社区,我希望使用中文和你进行沟通"
},
{
"role": "user",
"content": "这个社区整体帖子质量如何?"
}
]
}'
语音合成
curl --request POST \
--url https://api.oaifree.com/v1/audio/speech \
--header 'Authorization: Bearer your_ access token' \
--header 'content-type: application/json' \
--data '{
"model": "tts-1",
"voice": "onyx",
"input": "想要转音频的文本"
}'
语音转录
curl --request POST \
--url https://api.oaifree.com/v1/audio/transcriptions \
--header 'Authorization: Bearer your_access token' \
--header 'content-type: multipart/form-data' \
--form file=@file \
--form 'model="whisper-1"'
- API开发工具,用于测试、调试和共享HTTP API的免费开源工具
- 用到的 access token
-
看不懂English的可以在侧边栏中设置语言为简体中文
-
点击小下标箭头点击第一个导入cURL,这里的curl可以使用官方文档中的案例,也可以使用上方提供的cURl,具体按照自身要求进行修改
- 替换为有效的access token,也可以使用上方 DoneWell分享的 access token