返回提交历史
Modified
README.md
+20
-0
XFEstudio/gpt4free
Update README.md
Added example POST request to docs
e823fa7d
代码差异
1 个文件
+20
-0
@@ -427,6 +427,26 @@ if __name__ == "__main__":
427
427
main()
428
428
```
429
429
430
## API usage (POST)
431
#### Chat completions
432
Send the POST request to /v1/chat/completions with body containing the `model` method. This example uses python with requests library:
433
```python
434
import requests
435
url = "http://localhost:1337/v1/chat/completions"
436
body = {
437
"model": "gpt-3.5-turbo-16k",
438
"stream": False,
439
"messages": [
440
{"role": "assistant", "content": "What can you do?"}
441
]
442
}
443
json_response = requests.post(url, json=body).json().get('choices', [])
444
445
for choice in json_response:
446
print(choice.get('message', {}).get('content', ''))
447
```
448
449
430
450
## 🚀 Providers and Models
431
451
432
452
### GPT-4