POST
v1
/
gpt4free
Chat completion using G4F Endpoint
curl --request POST \
  --url http://localhost:9000/api/v1/gpt4free \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "messages": [
    {
      "role": "<string>",
      "content": "<string>"
    }
  ],
  "model": "<string>",
  "stream": true,
  "timeout": 123,
  "shuffle": true,
  "image_url": "<string>"
}'
{
  "response": "Large language models like me are advanced artificial intelligence systems designed to understand and generate human language. These models are trained on vast amounts of text data to learn patterns and relationships within language, enabling them to perform various tasks such as text generation, translation, summarization, and more. They are characterized by their ability to handle complex language tasks and generate coherent responses based on the input they receive."
}

Request Body

messages
array
required
Array of messages to send to the chat model.
model
string
default:"gpt-4o"
The model could be gpt-40, gpt-3.5-turbo or gpt-4
stream
boolean
Whether to stream the response or not.
timeout
int
timeout for the response to be sent.
shuffle
boolean
default:"false"
Shuffle the providers used for the chat completions. More details here
image_url
string
Include image for vision processing using the google gemini-pro model.

200 - Successful chat completion response

response
string
Response Text.

400 - Error message

error
string
The error message explaining what went wrong.
{
  "response": "Large language models like me are advanced artificial intelligence systems designed to understand and generate human language. These models are trained on vast amounts of text data to learn patterns and relationships within language, enabling them to perform various tasks such as text generation, translation, summarization, and more. They are characterized by their ability to handle complex language tasks and generate coherent responses based on the input they receive."
}