Overview

The AI API
For Developers

Access hundreds of AI models through a centralized interface.

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.

Poe API Key Page

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-poe

Advantages:

  • Native Python interface
  • Full feature support (custom parameters, file upload)
  • Better error handling
  • Async and sync support

View Python SDK Guide →

Best for OpenAI migration

Use the standard OpenAI SDK with Poe's base URL:

pip install openai  # Python
npm install openai  # Node.js

Advantages:

  • Drop-in replacement for OpenAI
  • Familiar interface
  • Works with existing OpenAI code
  • Multi-language support

View OpenAI SDK Guide →

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

View API Reference →

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:


📚 Client SDKs

Choose between the Poe Python SDK or OpenAI-compatible API

View SDK Options →

🤖 Available Models

Browse hundreds of AI models from all major providers

Explore Models →

💬 Chat Completions

Send messages, stream responses, use tools, and more

Chat API Reference →

💰 Check Balance

Monitor your current point balance

Balance API →

📊 Usage History

View detailed API usage and spending

Usage API →

🔧 OpenAI Compatible

Migrate from OpenAI in 60 seconds

Migration Guide →


Need Help?