diff options
author | Tekky <98614666+xtekky@users.noreply.github.com> | 2024-01-23 13:36:11 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-23 13:36:11 +0100 |
commit | 9a6df0210ad10817b962e8341dce1618f040d398 (patch) | |
tree | 12bc645e4c2c6fc995111b371505de8a68c2e43b | |
parent | Merge pull request #1508 from hlohaus/sort (diff) | |
parent | Merge pull request #1 from GetTuh/GetTuh-patch-1 (diff) | |
download | gpt4free-9a6df0210ad10817b962e8341dce1618f040d398.tar gpt4free-9a6df0210ad10817b962e8341dce1618f040d398.tar.gz gpt4free-9a6df0210ad10817b962e8341dce1618f040d398.tar.bz2 gpt4free-9a6df0210ad10817b962e8341dce1618f040d398.tar.lz gpt4free-9a6df0210ad10817b962e8341dce1618f040d398.tar.xz gpt4free-9a6df0210ad10817b962e8341dce1618f040d398.tar.zst gpt4free-9a6df0210ad10817b962e8341dce1618f040d398.zip |
Diffstat (limited to '')
-rw-r--r-- | README.md | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -427,6 +427,26 @@ if __name__ == "__main__": main() ``` +## API usage (POST) +#### Chat completions +Send the POST request to /v1/chat/completions with body containing the `model` method. This example uses python with requests library: +```python +import requests +url = "http://localhost:1337/v1/chat/completions" +body = { + "model": "gpt-3.5-turbo-16k", + "stream": False, + "messages": [ + {"role": "assistant", "content": "What can you do?"} + ] +} +json_response = requests.post(url, json=body).json().get('choices', []) + +for choice in json_response: + print(choice.get('message', {}).get('content', '')) +``` + + ## 🚀 Providers and Models ### GPT-4 |