#!/usr/bin/env python3
from openai import OpenAI

client = OpenAI(base_url="http://localhost:8080/v1",
                api_key="does-not-matter")

response = client.chat.completions.create(
    model="does-not-matter",
    messages=[
        {"role": "user",
         "content": "How do I use list comprehension in Python?"}
    ]
)
print(response.choices[0].message.content)

# optional: show additional response data
print(f"Input tokens:  {response.usage.prompt_tokens}")
print(f"Output tokens: {response.usage.completion_tokens}")
print(f"Total tokens:  {response.usage.total_tokens}")
