A local OpenAI-compatible API server wrapping the POE.com API, allowing you to seamlessly integrate POE’s AI models with your IDEs (like Xcode or Cursor) through a familiar OpenAI API interface.
- Wraps POE API: Translates OpenAI-compatible requests to POE-compatible calls.
- OpenAI Compatible: Integrates with any app expecting the OpenAI API format.
- Local & Public Access: Provides both localhost and secure public access via Cloudflare Tunnel.
- File Support: Manages file uploads and multimodal conversations.
- Zero Configuration Tunneling: Random URLs work without any account.
- Custom Domain Support: Use your own domain for permanent URLs.
- POE API Key: Obtain from https://poe.com/api_key
- Cloudflare Tunnel Token (Optional): Only needed if you want a custom domain instead of random URLs
Just run:
./setup.sh
The script handles everything automatically:
- Validates environment - Checks for Python, Docker, and Docker Compose
- Collects credentials - Prompts for POE API key if needed
- Generates secure API key - Creates a strong LOCAL_API_KEY automatically
- Optional custom domain - Asks if you want to use your own domain
- Starts services - Launches everything with the right configuration
- Shows your URLs - Displays both local and public endpoints
- URL:
https://random-name.trycloudflare.com
- Cost: FREE
- Requirements: None
- Note: URL changes on each restart
- URL:
https://poeapiwrapper.example.com
(your subdomain) - Cost: FREE (subdomains don't cost extra)
- Requirements: Cloudflare account + domain
- Benefit: Permanent URL that never changes
If you choose custom domain during ./setup.sh
, follow these steps:
-
Create Cloudflare Tunnel
- Go to https://one.dash.cloudflare.com/
- Navigate to Networks → Tunnels → Create a tunnel
- Select Cloudflared → Name your tunnel → Save tunnel
-
Configure Public Hostname
- Click Configure → Public Hostname
- Subdomain: Enter desired name (e.g.,
poeapiwrapper
) - Domain: Select your domain
- Service: HTTP →
poe-wrapper:8000
- Click Save
-
Get Token
- Go back to tunnel overview
- Find the Docker run command
- Copy the token (long string after
--token
)
-
Use in Setup
- When prompted, enter full subdomain (e.g.,
poeapiwrapper.example.com
) - Paste the token
- When prompted, enter full subdomain (e.g.,
- Host URL:
http://localhost:8000
- API Token: Your auto-generated
LOCAL_API_KEY
- Header:
x-api-key
- Host URL: Your Cloudflare tunnel URL
- Random:
https://random-name.trycloudflare.com
- Custom:
https://poeapiwrapper.example.com
- Random:
- API Token: Your auto-generated
LOCAL_API_KEY
GET /v1/models
– List available modelsPOST /v1/chat/completions
– Chat completions with streaming, tools, and attachmentsPOST /v1/completions
– Legacy text completionsPOST /v1/embeddings
– Generate embeddings (simulated)POST /v1/moderations
– Content moderation
POST /v1/images/generations
– Generate images from textPOST /v1/images/edits
– Edit images with promptsPOST /v1/images/variations
– Create image variations
GET /v1/files
– List uploaded filesPOST /v1/files/upload
– Upload filesGET /v1/files/{file_id}
– Get file detailsDELETE /v1/files/{file_id}
– Delete a file
/v1/assistants
– Manage assistants/v1/threads
– Manage conversation threads/v1/threads/{thread_id}/messages
– Thread messages/v1/threads/{thread_id}/runs
– Execute assistant runs
- Chat completions with streaming
- Temperature control
- Stop sequences
- File/image uploads (including base64)
- Image generation (DALL-E-3, Stable Diffusion)
- Function calling (native for GPT, Claude, Llama, DeepSeek, Grok, Perplexity, Qwen models; XML fallback for others)
- max_tokens: Via system prompts
- response_format: JSON mode via prompts
- Image editing: Creates new images instead
- Embeddings: LLM-generated vectors (won't work for RAG/similarity)
- Moderations: LLM analysis (not a safety system)
- Token counting: Word-based estimates
- Assistants API: In-memory only (data lost on restart)
n
, presence_penalty
, frequency_penalty
, top_p
, seed
, logit_bias
All Poe models are available with OpenAI-compatible names:
Image-Capable Models:
gpt-4o
,gpt-image-1
→ Can generate and analyze images
# Start Docker services
cd docker && docker-compose up --build -d
# View service logs
cd docker && docker-compose logs -f poe-wrapper
# Restart Docker services
cd docker && docker-compose restart
# Stop Docker services
cd docker && docker-compose down
# Retrieve Cloudflare tunnel URL
python scripts/get_cloudflare_url.py
After setup completion:
- Local API:
http://localhost:8000/v1
- Public API:
- Random:
https://random-name.trycloudflare.com/v1
(changes on restart) - Custom:
https://poeapiwrapper.example.com/v1
(permanent)
- Random:
- API Documentation:
http://localhost:8000/docs
- Python 3.12+
- Docker & Docker Compose
- Active internet connection
from openai import OpenAI
client = OpenAI(
api_key="your-local-api-key",
base_url="http://localhost:8000/v1"
)
# Basic chat
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "Hello!"}]
)
# With image
response = client.chat.completions.create(
model="gpt-4o",
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "What's in this image?"},
{"type": "image_url", "image_url": {"url": "data:image/jpeg;base64,..."}}
]
}]
)
# Function calling
response = client.chat.completions.create(
model="gpt-4o",
messages=[{"role": "user", "content": "What's the weather?"}],
tools=[{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get weather info",
"parameters": {
"type": "object",
"properties": {"location": {"type": "string"}},
"required": ["location"]
}
}
}]
)
-
URL changes on restart (Random URLs)
- This is normal behavior for free tunnels
- Use
python scripts/get_cloudflare_url.py
to get the new URL - Consider using a custom domain for permanent URLs
-
Authentication errors
- Verify your POE_API_KEY is correct
- Check LOCAL_API_KEY in requests
- Ensure x-api-key header is set
-
Model not found
- Run
GET /v1/models
to see available models - Use exact model names from the list
- Run
-
Image generation issues
- Ensure you're using image models (dall-e-3, stable-diffusion-xl, etc.)
- Check response format parameter (url or b64_json)
# View application logs
cd docker && docker-compose logs -f poe-wrapper
# Check specific log files
tail -f logs/app.log
tail -f logs/startup.log
Pull requests are welcome! Please ensure:
- Code follows existing patterns
- New features include documentation
- Tests pass (when available)
This project is licensed under the MIT License - see the LICENSE file for details.
This project is not affiliated with, endorsed by, or sponsored by Poe.com or OpenAI. It is intended for educational and personal use. Users are responsible for complying with the Terms of Service of Poe.com and any other services they connect to via this wrapper. Use at your own discretion.