C:\Users\BARATHI>curl -X POST http://localhost:6969/api/chat/completions \-H…
- User
user: C:\Users\BARATHI>curl -X POST http://localhost:6969/api/chat/completions -H "Content-Type: application/json" -d '{"model": "gpt-4o-turbo", "prompt": "123"}' --no-buffer { "type": "validation", "on": "body", "summary": "Expected object", "property": "root", "message": "Expected object", "expected": { "model": "gpt-o1-preview", "prompt": "" }, "errors": [ { "summary": "Expected object", "type": 46, "schema": { "type": "object", "properties": { "model": { "anyOf": [ { "const": "gpt-o1-preview", "type": "string" }, { "const": "gpt-o1-mini", "type": "string" }, { "const": "gpt-4o", "type": "string" }, { "const": "gpt-4o-turbo", "type": "string" }, { "const": "gpt-4o-mini", "type": "string" } ] }, "prompt": { "type": "string" }, "conversationId": { "type": "string" } }, "required": [ "model", "prompt" ], "additionalProperties": false }, "path": "", "message": "Expected object" } ] }curl: (3) URL rejected: Bad hostname curl: (3) URL rejected: Malformed input to a URL function curl: (3) URL rejected: Bad hostname curl: (3) unmatched brace in URL position 2: '{model: ^ assistant: It looks like you're encountering some issues with the
curlcommand and the JSON body you're sending in your API request. Let's break down the potential issues and how you might address them:-
Formatting of the
curlCommand:- Ensure that the command is correctly formatted. Each part of the command should be properly separated and escaped. If you're using a Windows command prompt, ensure that the escape character
^is correctly used for line continuation.
- Ensure that the command is correctly formatted. Each part of the command should be properly separated and escaped. If you're using a Windows command prompt, ensure that the escape character
-
JSON Body Formatting:
- Make sure that the JSON body you're sending is correctly formatted as a JSON object. Each key-value pair should be enclosed in double quotes.
-
Curl Escape Characters:
- Ensure that the backslashes
\are correctly placed only where necessary and are fully removed from paths or URLs when not needed.
- Ensure that the backslashes
Here is a corrected version of your
curlcommand:bash -
- Assistant
Let's go through the
curlcommand and aim to fix the issues step-by-step for you. I'll provide guidance for both Windows command prompt and Unix-like shells.Windows Command Prompt
In the Windows command prompt, you need to use the caret (
^) character for line continuation. The JSON payload requires special attention to ensure proper quoting:cmdcurl -X POST http://localhost:6969/api/chat/completions ^ -H "Content-Type: application/json" ^ -d "{\"model\":\"gpt-4o-turbo\", \"prompt\":\"123\"}" ^ --no-buffer