Overview
import fastapi_poe as fp
import os
# Initialize with your API key
api_key = os.environ['POE_API_KEY']
message = fp.ProtocolMessage(
role="user",
content="Why is the sky blue?"
)
# Stream responses from any model
for partial in fp.get_bot_response_sync(
messages=[message],
bot_name="Claude-Sonnet-4",
api_key=api_key
):
print(partial)import openai
import os
# Drop-in OpenAI replacement
client = openai.OpenAI(
api_key=os.environ['POE_API_KEY'],
base_url="https://api.poe.com/v1"
)
response = client.chat.completions.create(
model="GPT-5",
messages=[{
"role": "user",
"content": "Why is the sky blue?"
}]
)
print(response.choices[0].message.content)import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.POE_API_KEY,
baseURL: 'https://api.poe.com/v1'
});
const response = await client.chat
.completions.create({
model: 'Grok-4',
messages: [{
role: 'user',
content: 'Why is the sky blue?'
}]
});
console.log(response.choices[0]
.message.content);curl https://api.poe.com/v1/chat/completions \
-H "Authorization: Bearer $POE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "Claude-Sonnet-4",
"messages": [{
"role": "user",
"content": "Why is the sky blue?"
}]
}'Getting Started
Create Your API Key
Navigate to poe.com/api_key and create your API key.

Keep Your API Key Secure
Your API key provides access to your Poe account and point balance. Never share it publicly, commit it to version control, or expose it in client-side code.
API Key Best Practices:
- Store in environment variables, not in code
- Use different keys for development and production
- Rotate keys periodically
- Revoke compromised keys immediately from poe.com/api_key
Choose Your Integration Method
Pick the method that best fits your project:
Recommended for Python projects
Install the official Poe Python SDK:
pip install fastapi-poeAdvantages:
- Native Python interface
- Full feature support (custom parameters, file upload)
- Better error handling
- Async and sync support
Best for OpenAI migration
Use the standard OpenAI SDK with Poe's base URL:
pip install openai # Python
npm install openai # Node.jsAdvantages:
- Drop-in replacement for OpenAI
- Familiar interface
- Works with existing OpenAI code
- Multi-language support
For any language
Make direct HTTP requests to the Poe API:
curl https://api.poe.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"Claude-Sonnet-4","messages":[{"role":"user","content":"Hello!"}]}'Advantages:
- Works in any programming language
- No dependencies required
- Maximum flexibility
- Simple REST interface
Make Your First Request
Try this quick example to verify your setup:
import fastapi_poe as fp
import os
# Use the Poe Python SDK
api_key = os.environ['POE_API_KEY']
message = fp.ProtocolMessage(role="user", content="What are the top 3 things to do in NYC?")
for partial in fp.get_bot_response_sync(
messages=[message],
bot_name="Claude-Sonnet-4",
api_key=api_key
):
print(partial)import openai
import os
# Use the OpenAI SDK with Poe
client = openai.OpenAI(
api_key=os.environ['POE_API_KEY'],
base_url="https://api.poe.com/v1"
)
response = client.chat.completions.create(
model="Claude-Sonnet-4",
messages=[{"role": "user", "content": "What are the top 3 things to do in NYC?"}]
)
print(response.choices[0].message.content)curl https://api.poe.com/v1/chat/completions \
-H "Authorization: Bearer $POE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "Claude-Sonnet-4",
"messages": [
{"role": "user", "content": "What are the top 3 things to do in NYC?"}
]
}'import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.POE_API_KEY,
baseURL: 'https://api.poe.com/v1'
});
const response = await client.chat.completions.create({
model: 'Claude-Sonnet-4',
messages: [
{ role: 'user', content: 'What are the top 3 things to do in NYC?' }
]
});
console.log(response.choices[0].message.content);Explore the API
Now that you're set up, explore what the API can do:
- List Models - Browse all available models and their capabilities
- Chat Completions - Learn about advanced features like streaming, tool calling, and multi-modal inputs
- Check Balance - Monitor your point balance
- Usage History - Track your API usage
Quick Links
Need Help?
- Documentation: Browse the API Reference for detailed endpoint documentation
- Guides: Check out our External Applications Guide for comprehensive tutorials
- Support: Contact us at [email protected]