File size: 918 Bytes
315c659
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import asyncio
import httpx

async def main():
    try:
        async with httpx.AsyncClient(timeout=30.0) as client:
            print("HEALTH...")
            resp = await client.get("https://dherain24-claude-proxy.hf.space/health")
            print("HEALTH:", resp.status_code, resp.text)

            print("Testing auth...")
            resp = await client.post(
                "https://dherain24-claude-proxy.hf.space/v1/messages",
                headers={"x-api-key": "test_token"},
                json={
                    "model": "nvidia_nim/nvidia/llama-3.1-nemotron-ultra-253b-v1",
                    "messages": [{"role": "user", "content": "Hello"}],
                    "max_tokens": 10
                }
            )
            print("MESSAGES STATUS:", resp.status_code)
            print("MESSAGES BODY:", resp.text)
    except Exception as e:
        print("ERROR:", e)

asyncio.run(main())