Quickstart
Complete these three steps to verify your integration. Examples never contain real credentials.
1. Prepare an API key
Section titled “1. Prepare an API key”Copy your API key from the account entry point provided by MomoyAI and store it in a server-side environment variable:
export MOMOYAI_API_KEY="your-api-key"2. List available models
Section titled “2. List available models”curl https://cpa.momoyai.com/v1/models \ -H "Authorization: Bearer $MOMOYAI_API_KEY"Select a model from data[].id, or browse the model catalog.
3. Create a chat completion
Section titled “3. Create a chat completion”curl https://cpa.momoyai.com/v1/chat/completions \ -H "Authorization: Bearer $MOMOYAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "model": "gpt-5.4-mini", "messages": [ {"role": "user", "content": "Introduce MomoyAI in one sentence."} ] }'A JSON response containing choices confirms the basic connection. Production applications should also set timeouts, bounded retries, and log redaction.
OpenAI SDK
Section titled “OpenAI SDK”import OpenAI from "openai";
const client = new OpenAI({ apiKey: process.env.MOMOYAI_API_KEY, baseURL: "https://cpa.momoyai.com/v1",});
const response = await client.chat.completions.create({ model: "gpt-5.4-mini", messages: [{ role: "user", content: "Hello!" }],});
console.log(response.choices[0]?.message.content);Next, review authentication and streaming.