summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorJakub N <jakubniemczyk97@gmail.com>2024-01-22 20:01:53 +0100
committerGitHub <noreply@github.com>2024-01-22 20:01:53 +0100
commite823fa7dace54d215a2fd89cc9327d09cb8bbc0e (patch)
tree4b2ad44e482aed528ad1403b1d79b032f8799ce3 /README.md
parentMerge pull request #1501 from eltociear/patch-5 (diff)
downloadgpt4free-e823fa7dace54d215a2fd89cc9327d09cb8bbc0e.tar
gpt4free-e823fa7dace54d215a2fd89cc9327d09cb8bbc0e.tar.gz
gpt4free-e823fa7dace54d215a2fd89cc9327d09cb8bbc0e.tar.bz2
gpt4free-e823fa7dace54d215a2fd89cc9327d09cb8bbc0e.tar.lz
gpt4free-e823fa7dace54d215a2fd89cc9327d09cb8bbc0e.tar.xz
gpt4free-e823fa7dace54d215a2fd89cc9327d09cb8bbc0e.tar.zst
gpt4free-e823fa7dace54d215a2fd89cc9327d09cb8bbc0e.zip
Diffstat (limited to '')
-rw-r--r--README.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/README.md b/README.md
index 876779f0..a4365e09 100644
--- a/README.md
+++ b/README.md
@@ -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