"""Simplest possible use: one prompt in, text out, plus the full OpenAI-style response.""" from ccproxy_client import CCProxy, CCProxyError client = CCProxy() # reads CCPROXY_API_KEY and CCPROXY_BASE_URL from the environment try: print(client.complete("In one sentence, what does a reverse proxy do?", system="Answer plainly.")) res = client.chat.completions.create( model="sonnet", messages=[ {"role": "system", "content": "You are a concise assistant."}, {"role": "user", "content": "List three uses of a proxy server as bullet points."}, ], ) print("\n" + res["choices"][0]["message"]["content"]) u = res["usage"] print(f"\n[model {res['model']}, {u['prompt_tokens']} prompt + {u['completion_tokens']} completion tokens, finish={res['choices'][0]['finish_reason']}]") except CCProxyError as e: print(f"ccproxy error {e.status}: {e}")