File size: 618 Bytes
ecfad22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import httpx
import json
import asyncio


async def test():
    headers = {
        "Content-Type": "application/json",
        "Authorization": "Bearer sk-rOiDSQkoe2VgPbWJVbWbLXo2PrmEYVAVoFCrcNjGAMgPmnsOxLQ5XBsSHbGhrStv",
    }
    body = {"model": "kimi-k2.5", "messages": [{"role": "user", "content": "hello"}]}
    async with httpx.AsyncClient(timeout=30) as client:
        resp = await client.post(
            "https://opencode.ai/zen/go/v1/chat/completions", json=body, headers=headers
        )
        print(f"Status: {resp.status_code}")
        print(f"Response: {resp.text[:1000]}")


asyncio.run(test())