Skip to main content

OpenAI SDK Compatibility

This endpoint is fully compatible with the OpenAI SDK. Just change the baseURL and apiKey:
import OpenAI from 'openai';

const client = new OpenAI({
  apiKey: 'YOUR_EASY_PEASY_API_KEY',
  baseURL: 'https://easy-peasy.ai/api',
});

// Non-streaming
const response = await client.chat.completions.create({
  model: 'gemini-3-flash',
  messages: [
    { role: 'system', content: 'You are a helpful assistant.' },
    { role: 'user', content: 'Hello!' },
  ],
});
console.log(response.choices[0].message.content);

// Streaming
const stream = await client.chat.completions.create({
  model: 'gemini-3-flash',
  messages: [{ role: 'user', content: 'Tell me a story.' }],
  stream: true,
});
for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0]?.delta?.content || '');
}

Authentication

This endpoint supports two authentication methods:
  • x-api-key header: x-api-key: YOUR_API_KEY
  • Authorization header: Authorization: Bearer YOUR_API_KEY (OpenAI SDK default)

Multimodal Messages

You can send images and audio alongside text using the OpenAI multimodal message format.

Vision (Image Input)

Send images as URLs or base64 data URIs:
const response = await client.chat.completions.create({
  model: 'gemini-3-flash',
  messages: [
    {
      role: 'user',
      content: [
        { type: 'text', text: 'What do you see in this image?' },
        {
          type: 'image_url',
          image_url: { url: 'https://example.com/photo.jpg' },
        },
      ],
    },
  ],
});
Base64 images are also supported:
{
  "type": "image_url",
  "image_url": {
    "url": "data:image/png;base64,iVBORw0KGgo..."
  }
}

Audio Input

Send audio as base64-encoded data (mp3, wav, webm, mp4):
{
  "role": "user",
  "content": [
    { "type": "text", "text": "Transcribe this audio." },
    {
      "type": "input_audio",
      "input_audio": {
        "data": "base64-encoded-audio-data...",
        "format": "mp3"
      }
    }
  ]
}

Streaming

When stream: true, the response uses Server-Sent Events in OpenAI chunk format:
data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":...,"model":"gemini-3-flash","choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}]}

data: {"id":"chatcmpl-...","object":"chat.completion.chunk","created":...,"model":"gemini-3-flash","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

data: [DONE]