How to Deploy Your AI Character as an API in 5 Minutes

How to Deploy Your AI Character as an API in 5 Minutes

Meta Description: Deploy your Meganova Studio character as an embeddable chat widget or REST API. Step-by-step guide covering iFrame embed, JavaScript SDK, and Agent API with OpenAI-compatible endpoints.

Keywords: AI character API, deploy AI character, MegaNova Studio embed, character chat widget, agent API, OpenAI compatible API, AI chatbot deployment, embed character website


Two Deployment Paths

You want to... Use
Add a chat widget to a website Character Embed
Call your character from code / integrate into an app Agent API

Both are available from the studio with no server setup required.


Path 1 — Character Embed (For Websites)

Best for: blogs, landing pages, portfolios, customer-facing chat widgets.

Step 1: Open the Embed Tab

  1. Go to studio.meganova.ai and open your character
  2. Click the Embed tab in the Studio
  3. Click "Generate Embed Code"
  4. Configure your widget (Display → Behavior → Access Control)

Step 2: Configure

Display tab: theme (light/dark/auto), avatar visibility, dimensions, border radius

Behavior tab:

  • Memory modenone (each chat starts fresh) | session (remembers within session, up to 20 messages) | persistent (remembers across sessions)
  • Voice — enable/disable voice input/output
  • Safe modestandard or strict

Access Control tab:

  • Toggle Public Access on
  • Add Allowed Domains to restrict which sites can embed (optional but recommended)
  • Set Rate Limitlow (10 req/min) | medium (50 req/min) | high (200 req/min)

Step 3: Copy Your Code

The studio generates 3 options — pick one:

Option A — iFrame (simplest):

<iframe
  src="https://chat.meganova.ai/e/{your-cid}?theme=dark&voice=false&memory=session"
  width="100%"
  height="600"
  style="border:0; border-radius:12px;">
</iframe>

Option B — JavaScript Widget SDK:

<script src="https://cdn.meganova.ai/widget.js"></script>
<div id="mn-character"></div>
<script>
MegaNovaWidget.init({
  cid: "your-cid",
  container: "#mn-character",
  theme: "dark",
  memory: "session"
});
</script>

Option C — React component:

import { MegaNovaCharacter } from "@meganova/embed";

<MegaNovaCharacter
  cid="your-cid"
  theme="dark"
  memory="session"
/>

Analytics

The Embed tab shows a live dashboard: impressions, unique users, messages/session, voice usage, and active sessions — updated in real time.


Path 2 — Agent API (For Developers)

Best for: integrating your character into apps, bots, backends, or any custom interface.

Step 1: Create an Agent

Characters are deployed as APIs through the Agent system.

  1. Go to Agents in the sidebar → New Agent
  2. Assign your character as the agent's persona
  3. Configure tools, memory, and knowledge base as needed
  4. Click Publish → an API key is generated (format: agent_xxx...)

Step 2: Call the API

Basic chat endpoint:

POST https://studio-api.meganova.ai/api/agents/v1/{api_key}/chat
{
  "message": "Hello!",
  "conversation_id": "optional-uuid-for-continuity"
}

Response:

{
  "response": "Agent's reply",
  "conversation_id": "uuid",
  "tokens_used": 150,
  "status": "complete"
}

Pass the same conversation_id on subsequent messages to maintain conversation continuity.

Drop-in compatible with the OpenAI SDK and any OpenAI-compatible client:

from openai import OpenAI

client = OpenAI(
    api_key="agent_xxx...",
    base_url="https://studio-api.meganova.ai/api/agents/v1/agent_xxx..."
)

response = client.chat.completions.create(
    model="agent",
    messages=[{"role": "user", "content": "Hello!"}]
)

print(response.choices[0].message.content)

Supports both streaming and non-streaming responses.

Python SDK

pip install meganova
from meganova.cloud import CloudAgent

agent = CloudAgent(api_key="agent_xxx...")
response = agent.chat("What's your name?")
print(response)

Available Agent API Endpoints

Endpoint Purpose
GET /v1/{api_key}/info Agent metadata (name, description, avatar)
POST /v1/{api_key}/chat Send message, get response
POST /v1/{api_key}/chat/completions OpenAI-compatible endpoint
POST /v1/{api_key}/chat/confirm Confirm/reject a pending tool action

Managing Your API Key

  • Reveal key: Agent settings → "Reveal API Key"
  • Regenerate key: Agent settings → "Regenerate Key" (invalidates the old one immediately)

Which Path to Choose?

Character Embed Agent API
Setup time 2 minutes 5 minutes
Coding required No (iFrame) / Minimal (JS/React) Yes
Best for Websites, landing pages Apps, bots, backends
Analytics Built-in dashboard Track via tokens_used in response
Memory Configurable (none/session/persistent) Per conversation_id
Rate limiting 3 tiers in UI Managed by API key

Quick Checklist

Character Embed:

  • [ ] Embed tab → Generate Embed Code
  • [ ] Set memory mode and safe mode
  • [ ] Toggle Public Access on
  • [ ] Add allowed domains (optional)
  • [ ] Copy iFrame / JS / React snippet

Agent API:

  • [ ] Create Agent → assign character
  • [ ] Publish → copy API key
  • [ ] Test with /chat endpoint
  • [ ] Use OpenAI-compatible endpoint for SDK compatibility
  • [ ] Store API key securely (never expose in frontend code)

👉 Start deploying at studio.meganova.ai


Tags: #MeganovaStudio #APIDeployment #CharacterEmbed #AgentAPI #AICharacter #OpenAICompatible #ChatWidget

Stay Connected

💻 Website: Meganova Studio

🎮 Discord: Join our Discord

👽 Reddit: r/MegaNovaAI

🐦 Twitter: @meganovaai