Get Started
Using the API
Image generation
Image tools
Chat
Chat completion
POST
/
v1
/
chat
/
completions
Copy
Ask AI
curl --request POST \
--url https://openapi.monica.im/v1/chat/completions \
--header 'Authorization: Bearer <token>'
Follow the quickstart guide to get your own API Key.
Monica API Platform provides an OpenAI-compatible completion API to multiple models & providers that you can call directly or using the OpenAI SDK.
See models and pricing for all available models and pricing.
For more information about the request and response format, please refer to the OpenAI documentation.
Using the API
Copy
Ask AI
import OpenAI from "openai"
const openai = new OpenAI({
baseURL: "https://openapi.monica.im/v1",
apiKey: $YOUR_API_KEY,
})
async function main() {
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Explain this image"
},
{
"type": "image_url",
"image_url": {
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
}
}
]
}
]
})
console.log(completion.choices[0].message)
}
main()
Copy
Ask AI
import OpenAI from "openai"
const openai = new OpenAI({
baseURL: "https://openapi.monica.im/v1",
apiKey: $YOUR_API_KEY,
})
async function main() {
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Explain this image"
},
{
"type": "image_url",
"image_url": {
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
}
}
]
}
]
})
console.log(completion.choices[0].message)
}
main()
Copy
Ask AI
curl https://openapi.monica.im/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $YOUR_API_KEY" \
-d '{
"model": "gpt-4o",
"messages": [
{
"role": "user",
"content": [
{
"type": "text",
"text": "Explain this image"
},
{
"type": "image_url",
"image_url": {
"url": "https://upload.wikimedia.org/wikipedia/commons/thumb/d/dd/Gfp-wisconsin-madison-the-nature-boardwalk.jpg/2560px-Gfp-wisconsin-madison-the-nature-boardwalk.jpg"
}
}
]
}
]
}'
See also
Supported models & pricing
Assistant
Responses are generated using AI and may contain mistakes.