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.
EndpointGET /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.
EndpointPOST /v1/chat/completions
Body Parameters
Parameter | Type | Required | Description |
---|---|---|---|
model | string | Yes | The ID of the model to use (e.g., llama-3.1-8b ). |
messages | array | Yes | A list of message objects representing the conversation history. |
stream | boolean | No | If true , the response will be streamed as server-sent events. Defaults to false . |
... | any | No | Other standard OpenAI completion parameters are supported (e.g., temperature , max_tokens ). |
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.
EndpointPOST /v1/images/generations
Body Parameters
Parameter | Type | Required | Description |
---|---|---|---|
model | string | Yes | The ID of the image model to use (e.g., dall-e-3 ). |
prompt | string | Yes | A detailed text description of the desired image. |
n | integer | No | The number of images to generate. Defaults to 1 . |
size | string | No | The size of the generated images. Defaults to 1024x1024 . |
quality | string | No | The quality of the image. Can be standard or hd . |
Moderations
Check if a text string violates MapleAI's content policy.
EndpointPOST /v1/moderations
Body Parameters
Parameter | Type | Required | Description |
---|---|---|---|
model | string | Yes | The ID of the moderation model (e.g., text-moderation-latest ). |
input | string | Yes | The text to classify. |