> ## Documentation Index
> Fetch the complete documentation index at: https://easy-peasy.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Chat Completions (OpenAI-compatible)

> Use the OpenAI SDK’s chat.completions.create method with the Easy-Peasy.AI base URL and API key. Supports the request fields documented here, text responses, and SSE streaming. Multimodal support depends on the selected model. Tool calling, response_format, n, and other undocumented OpenAI options are not implemented by this endpoint.

## OpenAI SDK compatibility

Use the OpenAI SDK’s `chat.completions.create` method with the `baseURL` and `apiKey` below. This endpoint implements the request fields in this reference; tool calling, `response_format`, `n`, and other undocumented OpenAI options are not implemented.

<CodeGroup>
  ```javascript Node.js theme={null}
  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 || '');
  }
  ```

  ```python Python theme={null}
  from openai import OpenAI

  client = OpenAI(
      api_key="YOUR_EASY_PEASY_API_KEY",
      base_url="https://easy-peasy.ai/api",
  )

  response = client.chat.completions.create(
      model="gemini-3-flash",
      messages=[
          {"role": "system", "content": "You are a helpful assistant."},
          {"role": "user", "content": "Hello!"},
      ],
  )
  print(response.choices[0].message.content)
  ```

  ```bash cURL theme={null}
  curl -X POST https://easy-peasy.ai/api/chat/completions \
    -H "Content-Type: application/json" \
    -H "x-api-key: YOUR_API_KEY" \
    -d '{
      "messages": [
        {"role": "user", "content": "Hello!"}
      ],
      "model": "gemini-3-flash"
    }'
  ```
</CodeGroup>

## 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)

## Model IDs and aliases

The REST default is `gemini-3.8-flash`. The `gemini-3-flash` alias used in these examples follows the current Flash model and currently resolves to that default. Use an explicit version when you need to avoid a floating alias.

These IDs are routed by the chat endpoint; model availability, limits, and multimodal support depend on the provider.

| Provider  | Current model IDs                                                                                                                                                                                                                                                               |
| --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Google    | `gemini-3.8-flash`, `gemini-3.7-flash`, `gemini-3.6-flash`, `gemini-3.5-flash`, `gemini-3.1-pro`, `gemini-3-pro`                                                                                                                                                                |
| Anthropic | `claude-opus-5`, `claude-sonnet-5`, `claude-fable-5`, `claude-fable-5-1`, `claude-opus-4-8`, `claude-opus-4-7`, `claude-opus-4-6`, `claude-opus-4-5`, `claude-sonnet-4-6`, `claude-sonnet-4-5`, `claude-haiku-4-5`                                                              |
| OpenAI    | `gpt-6-astra`, `gpt-6-astra-max`, `gpt-5.6-sol`, `gpt-5.6-sol-max`, `gpt-5.6-terra`, `gpt-5.6-terra-max`, `gpt-5.6-luna`, `gpt-5.6-luna-max`, `gpt-5.5-instant`, `gpt-5.5-thinking`, `gpt-5.5-pro`, `gpt-5.4-instant`, `gpt-5.4-thinking`, `gpt-5.4-pro`, `gpt-5`, `gpt-5-mini` |
| DeepSeek  | `deepseek-v4-pro`, `deepseek-v4-flash`                                                                                                                                                                                                                                          |
| Moonshot  | `kimi-k3`, `kimi-k2.7-code`, `kimi-k2.6`                                                                                                                                                                                                                                        |
| Z.ai      | `glm-5p3`, `glm-5p3-max`, `glm-5p3-flash`, `glm-5p2`, `glm-5p1`, `glm-5`                                                                                                                                                                                                        |
| MiniMax   | `minimax-m3`                                                                                                                                                                                                                                                                    |
| Meta      | `muse-spark-1.3`, `muse-spark-1.3-max`                                                                                                                                                                                                                                          |
| Qwen      | `qwen3p8-max`                                                                                                                                                                                                                                                                   |
| xAI       | `grok-4`                                                                                                                                                                                                                                                                        |

Some older names select replacements, rather than the model their name suggests:

| Legacy ID                                                          | Resolves to         |
| ------------------------------------------------------------------ | ------------------- |
| `deepseek-v3`, `deepseek-r1`, `deepseek-chat`, `deepseek-reasoner` | `deepseek-v4-flash` |
| `minimax-m2`, `minimax-m2p5`, `minimax-m2p7`                       | `minimax-m3`        |
| `kimi-k2.5`, `kimi-k2-thinking`, `kimi-k2-instruct`                | `kimi-k2.6`         |
| `meta-llama-3.3-70b`, `llama4-maverick-instruct-basic`             | `muse-spark-1.3`    |
| `qwen3p6-plus`, `qwen3p7-plus`                                     | `qwen3p8-max`       |

Choose a listed ID. Unknown names may fall back to the default or reach a provider that rejects them. Parameters such as `temperature`, `top_p`, and `stop` are also model-dependent.

## Multimodal Messages

You can send images and audio alongside text using the OpenAI multimodal message format when the selected model supports that input. Accepting the message format does not make every model multimodal. Choose an image-capable model for vision and an audio-capable model for audio input.

### Vision (Image Input)

Send images as URLs or base64 data URIs:

<CodeGroup>
  ```javascript Node.js theme={null}
  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' },
          },
        ],
      },
    ],
  });
  ```

  ```python Python theme={null}
  response = 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"},
                  },
              ],
          }
      ],
  )
  ```

  ```bash cURL theme={null}
  curl -X POST https://easy-peasy.ai/api/chat/completions \
    -H "Content-Type: application/json" \
    -H "x-api-key: YOUR_API_KEY" \
    -d '{
      "messages": [{
        "role": "user",
        "content": [
          {"type": "text", "text": "What do you see?"},
          {"type": "image_url", "image_url": {"url": "https://example.com/photo.jpg"}}
        ]
      }]
    }'
  ```
</CodeGroup>

Base64 images are also supported:

```json theme={null}
{
  "type": "image_url",
  "image_url": {
    "url": "data:image/png;base64,iVBORw0KGgo..."
  }
}
```

### Audio Input

Send audio as base64-encoded data (mp3, wav, webm, mp4):

```json theme={null}
{
  "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]
```


## OpenAPI

````yaml POST /api/chat/completions
openapi: 3.0.1
info:
  title: Easy-Peasy.AI API
  description: >-
    API for Easy-Peasy.AI text, image, video, audio, and chat features.
    Authenticate with an API key from https://easy-peasy.ai/settings/api.
    Individual endpoints document public access and alternative authentication
    methods.
  version: 1.0.5
servers:
  - url: https://easy-peasy.ai
security:
  - apiKeyAuth: []
paths:
  /api/chat/completions:
    post:
      summary: Chat Completions (OpenAI-compatible)
      description: >-
        Use the OpenAI SDK’s chat.completions.create method with the
        Easy-Peasy.AI base URL and API key. Supports the request fields
        documented here, text responses, and SSE streaming. Multimodal support
        depends on the selected model. Tool calling, response_format, n, and
        other undocumented OpenAI options are not implemented by this endpoint.
      operationId: chatCompletions
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatCompletionsRequest'
            example:
              messages:
                - role: system
                  content: You are a helpful assistant.
                - role: user
                  content: Explain quantum computing in simple terms.
              model: gemini-3-flash
              temperature: 0.7
              max_tokens: 1000
      responses:
        '200':
          description: Chat completion response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChatCompletionsResponse'
              example:
                id: chatcmpl-1741234567890
                object: chat.completion
                created: 1741234567
                model: gemini-3-flash
                choices:
                  - index: 0
                    message:
                      role: assistant
                      content: Quantum computing is...
                    finish_reason: stop
                usage:
                  prompt_tokens: 25
                  completion_tokens: 150
                  total_tokens: 175
        '400':
          description: Bad request — messages is missing or empty
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIError'
              example:
                error:
                  message: messages is required and must be a non-empty array
                  type: server_error
        '401':
          description: Invalid or missing API key, or account blocked
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIError'
              example:
                error:
                  message: Invalid API key
                  type: server_error
        '429':
          description: Word allowance reached for the current plan.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIError'
              example:
                error:
                  message: Token limit reached for your subscription plan
                  type: server_error
        '500':
          description: Server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenAIError'
              example:
                error:
                  message: Internal server error
                  type: server_error
      security:
        - apiKeyAuth: []
        - bearerAuth: []
components:
  schemas:
    ChatCompletionsRequest:
      type: object
      required:
        - messages
      properties:
        messages:
          type: array
          description: Array of message objects for the conversation
          items:
            type: object
            required:
              - role
              - content
            properties:
              role:
                type: string
                enum:
                  - system
                  - user
                  - assistant
                description: The role of the message author
              content:
                oneOf:
                  - type: string
                    description: Text content of the message
                  - type: array
                    description: Multimodal content array (text, images, audio)
                    items:
                      oneOf:
                        - type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - text
                            text:
                              type: string
                          required:
                            - type
                            - text
                        - type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - image_url
                            image_url:
                              type: object
                              properties:
                                url:
                                  type: string
                                  description: >-
                                    Image URL or base64 data URI
                                    (data:image/png;base64,...)
                              required:
                                - url
                          required:
                            - type
                            - image_url
                        - type: object
                          properties:
                            type:
                              type: string
                              enum:
                                - input_audio
                            input_audio:
                              type: object
                              properties:
                                data:
                                  type: string
                                  description: Base64-encoded audio data
                                format:
                                  type: string
                                  enum:
                                    - mp3
                                    - wav
                                    - webm
                                    - mp4
                                  description: Audio format
                              required:
                                - data
                                - format
                          required:
                            - type
                            - input_audio
                description: >-
                  Message content — a string for text, or an array for
                  multimodal (text, images, audio)
          minItems: 1
        model:
          type: string
          default: gemini-3.8-flash
          description: >-
            Model ID from the Chat Completions model table. Default:
            gemini-3.8-flash. gemini-3-flash is a floating alias currently
            resolving to this default. Some legacy IDs resolve to replacement
            models. Unknown names may fall back to the default or be rejected by
            the provider; use a documented ID.
          example: gemini-3.8-flash
        stream:
          type: boolean
          default: false
          description: Enable Server-Sent Events streaming
        temperature:
          type: number
          description: >-
            Sampling temperature where supported by the chosen model. Some
            models ignore or reject custom values.
        max_tokens:
          type: integer
          description: Maximum tokens to generate
        top_p:
          type: number
          description: Nucleus sampling parameter
        stop:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
          description: Stop sequences
    ChatCompletionsResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the completion
        object:
          type: string
          enum:
            - chat.completion
          description: Object type
        created:
          type: integer
          description: Unix timestamp of creation
        model:
          type: string
          description: Model used for the completion
        choices:
          type: array
          items:
            type: object
            properties:
              index:
                type: integer
              message:
                type: object
                properties:
                  role:
                    type: string
                  content:
                    type: string
              finish_reason:
                type: string
        usage:
          type: object
          properties:
            prompt_tokens:
              type: integer
            completion_tokens:
              type: integer
            total_tokens:
              type: integer
    OpenAIError:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
              description: Error description
            type:
              type: string
              description: Error type
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key for authentication. Get yours at
        https://easy-peasy.ai/settings/api
    bearerAuth:
      type: http
      scheme: bearer
      description: Your Easy-Peasy.AI API key. Supported by Chat Completions.

````