curl --request POST \
--url https://openapi.monica.im/v1/chat/completions \
--header 'Authorization: Bearer <token>'
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
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()
See also
Supported models & pricing