xtekky / gpt4free

The official gpt4free repository | various collection of powerful language models
https://g4f.ai
GNU General Public License v3.0
60.03k stars 13.22k forks source link

New INSANE possible provider with popular models #1543

Closed OmiiiDev closed 7 months ago

OmiiiDev commented 7 months ago

This site has a lot of popular and powerful models: https://flowgpt.com/

peteh commented 7 months ago

They have a lot of security and regularly want to you to login via email again. You'd have to automate the email clicking somehow

OmiiiDev commented 7 months ago

They have a lot of security and regularly want to you to login via email again. You'd have to automate the email clicking somehow

I reversed engineered their AI image generator (Dalle 3 and studio ghibli), no security, nothing. Its simple, but I haven't tried for the Text models.

peteh commented 7 months ago

@OmiiiDev For me it switched to too many requests from your ip somehow. Even though the website continued working.

OmiiiDev commented 7 months ago

I don't know about the text models, but I will try to reverse engineer them

peteh commented 7 months ago

If you have some code to share I'd be interested.

OmiiiDev commented 7 months ago

Alright I will send the code here for the text models if I figure it out, I will let you know

OmiiiDev commented 7 months ago

If you have some code to share I'd be interested.

Here is the code example (post request in python):

import requests

url = "https://backend-k8s.flowgpt.com/v2/chat-anonymous"

headers = {
    "Authorization": "Bearer null",
    "Content-Type": "application/json",
    "Referer": "https://flowgpt.com/",
    "Sec-Ch-Ua": '"Not A(Brand";v="99", "Google Chrome";v="121", "Chromium";v="121"',
    "Sec-Ch-Ua-Mobile": "?0",
    "Sec-Ch-Ua-Platform": '"Windows"',
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36"
}

payload = {
    "model": "gpt-3.5-turbo",
    "nsfw": False,
    "question": "hello",
    "history": [
        {
            "role": "assistant",
            "content": "Hello there 😃, I am ChatGPT. How can I help you today?"
        }
    ],
    "system": "You are help assitant. Follow the user's instructions carefully. Respond using markdown",
    "temperature": 0.7,
    "promptId": "model-gpt-3.5-turbo",
    "documentIds": [],
    "chatFileDocumentIds": [],
    "generateImage": False,
    "generateAudio": False
}

response = requests.post(url, headers=headers, json=payload)

print("Response status code:", response.status_code)
print("Response body:", response.text)

and here is the response I got:

`Response status code: 200
Response body: {"event":"text","data":"Hello"}

{"event":"text","data":"!"}

{"event":"text","data":" How"}

{"event":"text","data":" can"}

{"event":"text","data":" I"}

{"event":"text","data":" assist"}

{"event":"text","data":" you"}

{"event":"text","data":" today"}

{"event":"text","data":"?"}`
OmiiiDev commented 7 months ago

@hlohaus please if you want or need, add a new provider (flowgpt) it has a lot of models, if you need any image models, I also reversed engineered it

peteh commented 7 months ago

Thanks it works for me and I don't get blocked (yet).

If you can post the image code I'd also be interested.

I think the response can also be streamed if you read bytes until you reach a \n\n and then parse the string as json. I'm not sure if this follows some standard. Does not look like websocket.

OmiiiDev commented 7 months ago

I just made a simple request with the necessary payload for it to reply.

If you can post the image code I'd also be interested.

What do you mean by post the image of the code?

peteh commented 7 months ago

The code for requesting images. Your reversed image api.

Sorry I was talking about two topics. I was looking at your code and how the server responds. If the tokens/words should be streamed it's possible. So technically you don't have to wait for the full response.

The server uses some weird custom format with long lasting post responses. It's a custom solution so that they can post word by word in the chat window.

The other question was if you would be willing to also share your reversed image api.

OmiiiDev commented 7 months ago

The other question was if you would be willing to also share your reversed image api.

Oh, right sorry about that, yes i will share it, this is for the dalle 3:

import requests

url = "https://backend-k8s.flowgpt.com/image-generation-anonymous"

headers = {
    "Accept": "application/json, text/plain, */*",
    "Accept-Encoding": "gzip, deflate, br",
    "Accept-Language": "en-GB,en-US;q=0.9,en;q=0.8,fr;q=0.7",
    "Content-Length": "84",
    "Content-Type": "application/json",
    "Origin": "https://flowgpt.com",
    "Referer": "https://flowgpt.com/",
    "Sec-Ch-Ua": '"Not A(Brand";v="99", "Google Chrome";v="121", "Chromium";v="121"',
    "Sec-Ch-Ua-Mobile": "?0",
    "Sec-Ch-Ua-Platform": '"Windows"',
    "Sec-Fetch-Dest": "empty",
    "Sec-Fetch-Mode": "cors",
    "Sec-Fetch-Site": "same-site",
    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36",
}

payload = {
    "model": "DALLE3",
    "prompt": "A car ", # add your custom prompt
}

response = requests.post(url, headers=headers, json=payload)

try:
    response_data = response.json()
    url_value = response_data.get("url", "No URL found in the response")
    print(f"URL: {url_value}")
except ValueError:
    print("Failed to parse JSON response.")
peteh commented 7 months ago

After a few tries with chatgpt3.5 it will still start to block me and respond with 429 code.

OmiiiDev commented 7 months ago

yeah, you might need to add a script that changes the user agent probably (idk, but it probably has rate limits)

peteh commented 7 months ago

Mhm user agent is not enough. So I guess after a few too many tries the ip gets blocked. Maybe the website does some other challenge to allow it again.

OmiiiDev commented 7 months ago

probably, I didn't fully test it.

github-actions[bot] commented 7 months ago

Bumping this issue because it has been open for 7 days with no activity. Closing automatically in 7 days unless it becomes active again.

github-actions[bot] commented 7 months ago

Closing due to inactivity.