Copy. Paste. Run. Working code for every engine in under 30 seconds.
30 seconds to first AI callGenerate context-aware NPC dialogue. Just set your API key and run.
import requests
API_KEY = "mg_live_YOUR_KEY_HERE" # Get yours at monstergaming.ai/onboard
response = requests.post(
"https://gateway.monstergaming.ai/v1/chat/completions",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"model": "deepseek-chat",
"messages": [
{"role": "system", "content": "You are a grumpy blacksmith NPC in a medieval RPG. "
"The player has visited 3 times. You're warming up to them but won't admit it."},
{"role": "user", "content": "Got any new swords today?"}
],
"max_tokens": 150,
"temperature": 0.8
}
)
npc_line = response.json()["choices"][0]["message"]["content"]
print(f"Blacksmith: {npc_line}")Scan your game code for bugs. Paste any file and get actionable feedback.
import requests
API_KEY = "mg_live_YOUR_KEY_HERE"
code_to_review = """
void Update() {
if (Input.GetKeyDown(KeyCode.Space))
rb.AddForce(Vector3.up * jumpForce);
isGrounded = false; // BUG: always runs (missing braces)
}
"""
response = requests.post(
"https://gateway.monstergaming.ai/v1/chat/completions",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"model": "deepseek-chat",
"messages": [
{"role": "system", "content": "You are a game dev QA expert. "
"Find bugs, rate severity (CRITICAL/HIGH/MEDIUM/LOW), suggest fixes. "
"Be concise. Use code blocks for fixes."},
{"role": "user", "content": f"Review this code:\n```\n{code_to_review}\n```"}
],
"max_tokens": 500
}
)
print(response.json()["choices"][0]["message"]["content"])Translate game strings to multiple languages in one call.
import requests, json
API_KEY = "mg_live_YOUR_KEY_HERE"
strings_to_translate = [
"Fire at will!",
"Health potion restored 50 HP",
"Quest complete: The Dragon's Lair"
]
response = requests.post(
"https://gateway.monstergaming.ai/v1/chat/completions",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"model": "deepseek-chat",
"messages": [
{"role": "system", "content": "Translate these game strings to Korean, Japanese, "
"and Spanish. Output as JSON: {\"ko\": [...], \"ja\": [...], \"es\": [...]}. "
"Preserve game context (Fire = shoot, not element)."},
{"role": "user", "content": json.dumps(strings_to_translate)}
],
"max_tokens": 500,
"temperature": 0.3
}
)
translations = response.json()["choices"][0]["message"]["content"]
print(translations)Works with any Node.js project. Zero dependencies beyond fetch.
const API_KEY = "mg_live_YOUR_KEY_HERE";
const response = await fetch("https://gateway.monstergaming.ai/v1/chat/completions", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "deepseek-chat",
messages: [
{ role: "system", content: "You are a mysterious fortune teller NPC. Speak in riddles. Short responses." },
{ role: "user", content: "What lies ahead on my journey?" }
],
max_tokens: 100,
temperature: 0.9
})
});
const data = await response.json();
console.log("Fortune Teller:", data.choices[0].message.content);
console.log("Cost:", `$${(data.usage.total_tokens * 0.000002).toFixed(6)}`);Real-time streaming for chat UIs. Works in any browser.
async function streamNPC(playerInput) {
const response = await fetch("https://gateway.monstergaming.ai/v1/chat/completions", {
method: "POST",
headers: {
"Authorization": `Bearer ${API_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
model: "deepseek-chat",
messages: [
{ role: "system", content: "You are a tavern keeper. Friendly but busy." },
{ role: "user", content: playerInput }
],
max_tokens: 150,
stream: true
})
});
const reader = response.body.getReader();
const decoder = new TextDecoder();
let fullText = "";
while (true) {
const { done, value } = await reader.read();
if (done) break;
const chunk = decoder.decode(value);
for (const line of chunk.split("\n")) {
if (line.startsWith("data: ") && line !== "data: [DONE]") {
const json = JSON.parse(line.slice(6));
const token = json.choices[0]?.delta?.content || "";
fullText += token;
document.getElementById("npc-text").textContent = fullText;
}
}
}
}Drop this on any NPC GameObject. Generates contextual dialogue on interaction.
using UnityEngine;
using UnityEngine.Networking;
using System.Collections;
using Newtonsoft.Json.Linq;
public class MonsterNPC : MonoBehaviour
{
[SerializeField] private string apiKey = "mg_live_YOUR_KEY_HERE";
[SerializeField] private string personality = "A grumpy blacksmith who secretly cares";
[TextArea] public string lastResponse;
public void GenerateDialogue(string playerSays)
{
StartCoroutine(CallMonsterAI(playerSays));
}
private IEnumerator CallMonsterAI(string input)
{
var body = JsonUtility.ToJson(new {
model = "deepseek-chat",
messages = new[] {
new { role = "system", content = personality + ". One sentence max." },
new { role = "user", content = input }
},
max_tokens = 80
});
var request = new UnityWebRequest(
"https://gateway.monstergaming.ai/v1/chat/completions",
"POST"
);
request.uploadHandler = new UploadHandlerRaw(System.Text.Encoding.UTF8.GetBytes(body));
request.downloadHandler = new DownloadHandlerBuffer();
request.SetRequestHeader("Authorization", $"Bearer {apiKey}");
request.SetRequestHeader("Content-Type", "application/json");
yield return request.SendWebRequest();
if (request.result == UnityWebRequest.Result.Success)
{
var json = JObject.Parse(request.downloadHandler.text);
lastResponse = json["choices"][0]["message"]["content"].ToString();
}
}
}Attach to any NPC node. Call generate_dialogue() on interaction.
extends Node
@export var api_key: String = "mg_live_YOUR_KEY_HERE"
@export var personality: String = "A mysterious merchant who trades in secrets"
signal dialogue_received(text: String)
func generate_dialogue(player_input: String) -> void:
var http = HTTPRequest.new()
add_child(http)
http.request_completed.connect(_on_response.bind(http))
var body = JSON.stringify({
"model": "deepseek-chat",
"messages": [
{"role": "system", "content": personality + ". Keep responses under 2 sentences."},
{"role": "user", "content": player_input}
],
"max_tokens": 100
})
var headers = [
"Authorization: Bearer " + api_key,
"Content-Type: application/json"
]
http.request(
"https://gateway.monstergaming.ai/v1/chat/completions",
headers, HTTPClient.METHOD_POST, body
)
func _on_response(result, code, headers, body, http):
http.queue_free()
if code == 200:
var json = JSON.parse_string(body.get_string_from_utf8())
var text = json["choices"][0]["message"]["content"]
dialogue_received.emit(text)Verify your API key works. Paste into any terminal.
curl -X POST https://gateway.monstergaming.ai/v1/chat/completions \
-H "Authorization: Bearer mg_live_YOUR_KEY_HERE" \
-H "Content-Type: application/json" \
-d '{
"model": "deepseek-chat",
"messages": [
{"role": "system", "content": "You are a game NPC. One sentence."},
{"role": "user", "content": "Hello!"}
],
"max_tokens": 50
}'See all 385+ models available through your account.
curl https://gateway.monstergaming.ai/v1/models \ -H "Authorization: Bearer mg_live_YOUR_KEY_HERE"
Sign up, get $5 free credit, paste your key into any snippet above. That's it.
Get Started Free