MapleAI

MapleAI API Documentation

Welcome to the MapleAI API! Our goal is to provide a powerful, fast, and easy-to-use interface for integrating state-of-the-art AI models into your applications. This API is designed to be a drop-in replacement for the OpenAI API, allowing for seamless integration with existing tools and SDKs.

Authentication

All API requests must be authenticated using a Bearer token. You can get your API key from your MapleAI Dashboard.

Include your API key in the Authorization header of your requests:

Authorization: Bearer YOUR_API_KEY

All requests should be made to the following base URL:

https://api.mapleai.lol

Endpoints

List Models

Retrieve a list of all available models compatible with the API.

Endpoint
GET /v1/models
Example Request
curl https://api.mapleai.lol/v1/models \
  -H "Authorization: Bearer sk-mapleai-xxxxxxxx"

Chat Completions

Generate a response to a conversational prompt. This endpoint supports both standard and streaming responses.

Endpoint
POST /v1/chat/completions
Body Parameters
ParameterTypeRequiredDescription
modelstringYesThe ID of the model to use (e.g., llama-3.1-8b).
messagesarrayYesA list of message objects representing the conversation history.
streambooleanNoIf true, the response will be streamed as server-sent events. Defaults to false.
...anyNoOther standard OpenAI completion parameters are supported (e.g., temperature, max_tokens).
Example Request
curl https://api.mapleai.lol/v1/chat/completions \
  -H "Authorization: Bearer sk-mapleai-xxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "llama-3.1-8b",
    "messages": [
      { "role": "system", "content": "You are a helpful assistant." },
      { "role": "user", "content": "Hello! Who are you?" }
    ]
  }'

Image Generations

Create an image from a text prompt.

Endpoint
POST /v1/images/generations
Body Parameters
ParameterTypeRequiredDescription
modelstringYesThe ID of the image model to use (e.g., dall-e-3).
promptstringYesA detailed text description of the desired image.
nintegerNoThe number of images to generate. Defaults to 1.
sizestringNoThe size of the generated images. Defaults to 1024x1024.
qualitystringNoThe quality of the image. Can be standard or hd.

Moderations

Check if a text string violates MapleAI's content policy.

Endpoint
POST /v1/moderations
Body Parameters
ParameterTypeRequiredDescription
modelstringYesThe ID of the moderation model (e.g., text-moderation-latest).
inputstringYesThe text to classify.