Uname:Linux antigravity-cli 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64

Base Dir : /var/www/moonbloom

User : wp-moonbloom


403WebShell
403Webshell
Server IP : 85.155.190.233  /  Your IP : 216.73.216.103
Web Server : nginx/1.24.0
System : Linux antigravity-cli 6.8.0-31-generic #31-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 20 00:40:06 UTC 2024 x86_64
User : wp-moonbloom ( 1001)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /opt/Gemini_Swarm_Core/scripts/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/Gemini_Swarm_Core/scripts/test_vertex_on_googleai.py
import json
import httpx
import os

def test():
    # Read oauth_creds.json
    oauth_path = "/root/.gemini/oauth_creds.json"
    if not os.path.exists(oauth_path):
        oauth_path = "/opt/Gemini_Swarm_Core/.gemini/oauth_creds.json"
    
    with open(oauth_path) as f:
        data = json.load(f)
    
    token = data.get("access_token")
    headers = {
        "Authorization": f"Bearer {token}",
        "Content-Type": "application/json",
        "x-goog-user-project": "gen-lang-client-0207686288"
    }

    # Test URLs
    urls = [
        # Vertex-like path on generativelanguage
        ("Vertex-like us-central1", "https://generativelanguage.googleapis.com/v1beta/projects/gen-lang-client-0207686288/locations/us-central1/publishers/google/models/gemini-2.5-flash:generateContent"),
        # Vertex-like global
        ("Vertex-like global", "https://generativelanguage.googleapis.com/v1beta/projects/gen-lang-client-0207686288/locations/global/publishers/google/models/gemini-2.5-flash:generateContent"),
        # Project-prefixed models path
        ("Project-prefixed models", "https://generativelanguage.googleapis.com/v1beta/projects/gen-lang-client-0207686288/models/gemini-2.5-flash:generateContent"),
    ]

    payload = {
        "contents": [{"parts": [{"text": "Hello! Answer in Russian in 3 words."}]}]
    }

    for name, url in urls:
        print(f"\n--- Testing: {name} ---")
        print("URL:", url)
        try:
            r = httpx.post(url, json=payload, headers=headers)
            print("Status:", r.status_code)
            print("Response:", r.text[:400])
        except Exception as e:
            print("Error:", e)

if __name__ == "__main__":
    test()

Youez - 2016 - github.com/yon3zu
LinuXploit