Official Python client for the Poe chat completions API.
pip install poefrompoeimportPoeClientclient=PoeClient(api_key="your-poe-api-key")
# Simple chatresponse=client.chat("What is Python?", model="GPT-4o")
print(response["choices"][0]["message"]["content"])forchunkinclient.stream("Tell me a story", model="GPT-4o"):
print(chunk, end="", flush=True)client=PoeClient(
api_key="your-key",
timeout=120.0, # request timeout in seconds
)
response=client.chat(
"Explain quantum computing",
model="GPT-4o",
temperature=0.7,
max_tokens=1024,
system_prompt="You are a helpful physics teacher.",
)withPoeClient(api_key="your-key") asclient:
resp=client.chat("Hello!")
print(resp["choices"][0]["message"]["content"])Get your API key from poe.com/api_key.
MIT