Chat

ARK Platform Example / Chat

  • Copy
    
    import openai
    
    ark_api_key = "API_KEY"
    ark_base_url = "https://api.ark-labs.cloud/api/v1"
    
    client = openai.OpenAI(api_key=ark_api_key, base_url=ark_base_url)
    
    print("Waiting for response...")
    
    response = client.chat.completions.create(
        model="gpt-4o",
        messages=[
            {"role": "system", "content": "You are a helpful assistant."},
            {"role": "user", "content": "Tell me a story about a brave knight traversing space in a small rocket who's lost because GPS only works on Earth. 200 words."}
        ],
    )
    
    print("Response:")
    print(response.choices[0].message.content)