{{ t('h1Overview') }}

{{ t('overviewIntro') }}

{{ t('overviewWhyHeading') }}

  1. {{ t('overviewWhy1') }}
  2. {{ t('overviewWhy2') }}
  3. {{ t('overviewWhy3') }}
  4. {{ t('overviewWhy4') }}

{{ t('h1Quickstart') }}

{{ t('quickstartBody') }} {{ t('quickstartGetKey') }}{{ t('quickstartAndSet') }}

{{ t('quickstartHereIsExample') }}

                    from openai import OpenAI

client = OpenAI(
    base_url="https://api.mnnai.ru/v1"
)

completion = client.chat.completions.create(
    model="gpt-5.4",
    messages=[
        {
            "role": "user",
            "content": "Give me a short panda story"
        }
    ]
)

print(completion.choices[0].message.content)
                    
import OpenAI from "openai";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const completion = await client.chat.completions.create({
    model: "gpt-5.4",
    messages: [
        { role: "user", content: "Give me a short panda story" }
    ],
});

console.log(completion.choices[0].message.content);
curl https://api.mnnai.ru/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -d '{
    "model": "gpt-5.4",
    "messages": [{"role": "user", "content": "Give me a short panda story"}]
  }'

{{ t('quickstartRunInstallBefore') }} pip install openai{{ t('quickstartRunInstallAfter') }}

{{ t('h1Models') }}

{{ t('modelsIntro') }}

{{ t('modelsExampleList') }}

from openai import OpenAI

client = OpenAI(
    base_url="https://api.mnnai.ru/v1"
)

models = client.models.list()

for model in models.data:
    print(model.id)
import OpenAI from "openai";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const models = await client.models.list();

for (const model of models.data) {
    console.log(model.id);
}
curl https://api.mnnai.ru/v1/models \
  -H "Authorization: Bearer $MNN_API_KEY"

{{ t('modelsNoteStrong') }} {{ t('modelsNoteBody') }} {{ t('modelsDashboardLink') }}{{ t('modelsNoteAfter') }}

{{ t('h1Pricing') }}

{{ t('pricingIntro') }}

{{ t('pricingTableHeaderFeature') }} {{ t('pricingTableHeaderFree') }} {{ t('pricingTableHeaderBasic') }} {{ t('pricingTableHeaderPro') }} {{ t('pricingTableHeaderUltra') }} {{ t('pricingTableHeaderScale') }} {{ t('pricingTableHeaderEnterprise') }} {{ t('pricingTableHeaderPayg') }}
{{ t('pricingRowPrice') }} $0/mo $5/mo $10/mo $15/mo $30/mo $60/mo {{ t('pricingPaygPrice') }}
{{ t('pricingRowCredits') }} {{ t('pricingCreditsPriceMo') }} $20 $50 $100 $150 $300 {{ t('pricingPaygTopup') }}
{{ t('pricingRowRateLimit') }} 10 50 100 150 200 400 10
{{ t('pricingRowModelAccess') }} {{ t('pricingRateFree') }} {{ t('pricingRateBasic') }} {{ t('pricingRateAll') }} {{ t('pricingRateAll') }} {{ t('pricingRateAll') }} {{ t('pricingRateAll') }} {{ t('pricingRateAll') }}
{{ t('pricingRowWebSearch') }} {{ t('pricingYes') }} {{ t('pricingYes') }} {{ t('pricingYes') }} {{ t('pricingYes') }} {{ t('pricingYes') }} {{ t('pricingYes') }} {{ t('pricingYes') }}
{{ t('pricingRowMediaAnalysis') }} {{ t('pricingMediaTextImage') }} {{ t('pricingAudioPlus') }} {{ t('pricingAudioPlus') }} {{ t('pricingAudioPlus') }} {{ t('pricingAudioPlus') }} {{ t('pricingAudioPlus') }} {{ t('pricingAudioPlus') }}
{{ t('pricingRowFunctionCalling') }} {{ t('pricingNo') }} {{ t('pricingYes') }} {{ t('pricingYes') }} {{ t('pricingYes') }} {{ t('pricingYes') }} {{ t('pricingYes') }} {{ t('pricingYes') }}
{{ t('pricingRowSupport') }} {{ t('pricingStandardSupport') }} {{ t('pricingStandardSupport') }} {{ t('pricingPrioritySupport') }} {{ t('pricingPrioritySupport') }} {{ t('pricingPrioritySupport') }} {{ t('pricingPrioritySupport') }} {{ t('pricingStandardSupport') }}

{{ t('pricingHeadingCredits') }}

{{ t('pricingCredits1') }}

{{ t('pricingCredits2') }}

{{ t('pricingCredits3') }}

{{ t('pricingHeadingFaq') }}

  1. {{ t('pricingFaq1Q') }}

    {{ t('pricingFaq1A') }}

  2. {{ t('pricingFaq2Q') }}

    {{ t('pricingFaq2A') }}

  3. {{ t('pricingFaq3Q') }}

    {{ t('pricingFaq3A') }}

  4. {{ t('pricingFaq4Q') }}

    {{ t('pricingFaq4A') }}

  5. {{ t('pricingFaq5Q') }}

    {{ t('pricingFaq5ABefore') }} {{ t('pricingDiscordLink') }}{{ t('pricingFaq5AAfter') }}

{{ t('pricingHeadingPayg') }}

{{ t('pricingPaygBody') }}

{{ t('h1Locations') }}

{{ t('locationsIntro') }}

https://rapi.mnnai.ru/v1 {{ t('locationsRussia') }}

https://dapi.mnnai.ru/v1 {{ t('locationsGermany') }}

https://api.mnnai.ru/v1 {{ t('locationsGlobal') }}

{{ t('h1TextGeneration') }}

{{ t('textGenIntro') }}

{{ showResponses ? t('apiChatCompletions') : t('apiResponses') }}
from openai import OpenAI

client = OpenAI(
    base_url="https://api.mnnai.ru/v1"
)

response = client.chat.completions.create(
    model="mistral-medium-latest",
    messages=[
        {"role": "user", "content": "Summarize this: [long text]"}
    ],
    temperature=0.7
)

print(response.choices[0].message.content)
import OpenAI from "openai";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const response = await client.chat.completions.create({
    model: "mistral-medium-latest",
    messages: [
        { role: "user", content: "Summarize this: [long text]" }
    ],
    temperature: 0.7
});

console.log(response.choices[0].message.content);
curl https://api.mnnai.ru/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -d '{
    "model": "mistral-medium-latest",
    "messages": [{"role": "user", "content": "Summarize this: [long text]"}],
    "temperature": 0.7
  }'
from openai import OpenAI

client = OpenAI(
    base_url="https://api.mnnai.ru/v1"
)

response = client.responses.create(
    model="mistral-medium-latest",
    input="Write a one-sentence bedtime story about a hypercorn."
)

print(response.output_text)
import OpenAI from "openai";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const response = await client.responses.create({
    model: "mistral-medium-latest",
    input: "Write a one-sentence bedtime story about a hypercorn."
});

console.log(response.output_text);
curl https://api.mnnai.ru/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -d '{
    "model": "mistral-medium-latest",
    "input": "Write a one-sentence bedtime story about a hypercorn."
  }'

{{ t('h1Reasoning') }}

{{ t('reasoningIntro') }}

{{ t('reasoningEffortModelsBefore') }} GET /v1/models {{ t('reasoningEffortModelsBetween') }} effort_types {{ t('reasoningEffortModelsAfter') }}

{{ t('reasoningEffortFieldsBefore') }} reasoning_effort {{ t('reasoningEffortFieldsChat') }} reasoning.effort {{ t('reasoningEffortFieldsResponses') }} output_config.effort {{ t('reasoningEffortFieldsAfter') }}

{{ showResponses ? t('apiChatCompletions') : t('apiResponses') }}
from openai import OpenAI

client = OpenAI(
    base_url="https://api.mnnai.ru/v1"
)

prompt = """
Write a bash script that takes a matrix represented as a string with
format '[1,2],[3,4],[5,6]' and prints the transpose in the same format.
"""

response = client.chat.completions.create(
    model="glm-5",
    reasoning_effort="medium",
    messages=[
        {
            "role": "user",
            "content": prompt
        }
    ]
)

print(response.choices[0].message.content)
import OpenAI from "openai";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const prompt = `
Write a bash script that takes a matrix represented as a string with
format '[1,2],[3,4],[5,6]' and prints the transpose in the same format.
`;

const response = await client.chat.completions.create({
    model: "glm-5",
    reasoning_effort: "medium",
    messages: [
        { role: "user", content: prompt }
    ],
});

console.log(response.choices[0].message.content);
curl https://api.mnnai.ru/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -d '{
    "model": "glm-5",
    "reasoning_effort": "medium",
    "messages": [{"role": "user", "content": "Write a bash script that takes a matrix represented as a string with format [1,2],[3,4],[5,6] and prints the transpose in the same format."}]
  }'
from openai import OpenAI

client = OpenAI(
    base_url="https://api.mnnai.ru/v1"
)

prompt = """
Write a bash script that takes a matrix represented as a string with
format '[1,2],[3,4],[5,6]' and prints the transpose in the same format.
"""

response = client.responses.create(
    model="glm-5",
    reasoning={"effort": "medium"},
    input=[
        {
            "role": "user",
            "content": prompt
        }
    ]
)

print(response.output_text)
import OpenAI from "openai";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const prompt = `
Write a bash script that takes a matrix represented as a string with
format '[1,2],[3,4],[5,6]' and prints the transpose in the same format.
`;

const response = await client.responses.create({
    model: "glm-5",
    reasoning: { effort: "medium" },
    input: [
        { role: "user", content: prompt }
    ],
});

console.log(response.output_text);
curl https://api.mnnai.ru/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -d '{
    "model": "glm-5",
    "reasoning": {"effort": "medium"},
    "input": [{"role": "user", "content": "Write a bash script that takes a matrix represented as a string with format [1,2],[3,4],[5,6] and prints the transpose in the same format."}]
  }'

{{ t('reasoningNote1') }}

{{ t('reasoningFormatTitle') }}

{{ t('reasoningFormatDesc') }}

{{ t('reasoningOutdatedTitle') }}

{{ t('reasoningOutdatedDesc') }}

curl https://api.mnnai.ru/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -d '{
    "model": "glm-5",
    "reasoning_effort": "medium",
    "outdated_reasoning": true,
    "messages": [{"role": "user", "content": "Explain quantum entanglement briefly."}]
  }'
response = client.chat.completions.create(
    model="glm-5",
    reasoning_effort="medium",
    extra_body={"outdated_reasoning": True},
    messages=[
        {"role": "user", "content": "Explain quantum entanglement briefly."}
    ]
)
const response = await client.chat.completions.create({
    model: "glm-5",
    reasoning_effort: "medium",
    outdated_reasoning: true,
    messages: [
        { role: "user", content: "Explain quantum entanglement briefly." }
    ]
});

{{ t('h1Images') }}

{{ t('imagesIntro') }}

from openai import OpenAI

client = OpenAI(
    base_url="https://api.mnnai.ru/v1"
)

response = client.images.generate(
    model="z-image-turbo",
    prompt="A futuristic city at sunset",
    extra_body={"enhance": True} # If this parameter is specified, your prompt will be automatically enhanced
)

print(response.data[0].url)
import OpenAI from "openai";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const response = await client.images.generate({
    model: "z-image-turbo",
    prompt: "A futuristic city at sunset",
    extra_body: { enhance: true }
});

console.log(response.data[0].url);
curl https://api.mnnai.ru/v1/images/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -d '{
    "model": "z-image-turbo",
    "prompt": "A futuristic city at sunset",
    "enhance": true
  }'

{{ t('imagesNoteStrong') }} {{ t('imagesNoteBody') }}

{{ t('h1Edits') }}

{{ t('editsIntro') }}

from openai import OpenAI

client = OpenAI(
    base_url="https://api.mnnai.ru/v1"
)

response = client.images.edit(
    model="gpt-image-1-edit",
    image=open("cat.png", "rb"),
    prompt="Change the background of the image to space",
    response_format="url"
)
print(response.data[0].url)
import OpenAI from "openai";
import fs from "fs";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const response = await client.images.edit({
    model: "gpt-image-1-edit",
    image: fs.createReadStream("cat.png"),
    prompt: "Change the background of the image to space",
    response_format: "url"
});

console.log(response.data[0].url);
curl https://api.mnnai.ru/v1/images/edits \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -F image="@cat.png" \
  -F model="gpt-image-1-edit" \
  -F prompt="Change the background of the image to space" \
  -F response_format="url"

{{ t('h1Vision') }}

{{ t('visionIntro') }}

{{ showVisionResponses ? t('apiChatCompletions') : t('apiResponses') }}
from openai import OpenAI

client = OpenAI(
    base_url="https://api.mnnai.ru/v1"
)

response = client.chat.completions.create(
    model="gpt-5.2",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "What's in 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",
                },
            },
        ],
    }],
)

print(response.choices[0].message.content)
import OpenAI from "openai";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const response = await client.chat.completions.create({
    model: "gpt-5.2",
    messages: [
        {
            role: "user",
            content: [
                { type: "text", text: "What's in 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(response.choices[0].message.content);
curl https://api.mnnai.ru/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -d '{
    "model": "gpt-5.2",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "What is in 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"
            }
          }
        ]
      }
    ]
  }'
from openai import OpenAI

client = OpenAI(
    base_url="https://api.mnnai.ru/v1"
)

response = client.responses.create(
    model="gpt-5.2",
    input=[{
        "role": "user",
        "content": [
            {"type": "input_text", "text": "what's in this image?"},
            {
                "type": "input_image",
                "image_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",
            },
        ],
    }],
)

print(response.output_text)
import OpenAI from "openai";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const response = await client.responses.create({
    model: "gpt-5.2",
    input: [
        {
            role: "user",
            content: [
                { type: "input_text", text: "what's in this image?" },
                {
                    type: "input_image",
                    image_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(response.output_text);
curl https://api.mnnai.ru/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -d '{
    "model": "gpt-5.2",
    "input": [
      {
        "role": "user",
        "content": [
          {
            "type": "input_text",
            "text": "what is in this image?"
          },
          {
            "type": "input_image",
            "image_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"
          }
        ]
      }
    ]
  }'

{{ t('h1Pdf') }}

{{ t('pdfIntro') }}

{{ showVisionResponses ? t('apiChatCompletions') : t('apiResponses') }}
import base64
from openai import OpenAI

def encode_pdf_to_base64(pdf_path):
    with open(pdf_path, "rb") as pdf_file:
        return base64.b64encode(pdf_file.read()).decode("utf-8")

client = OpenAI(
    base_url="https://api.mnnai.ru/v1",
    api_key="your-api-key"
)

pdf_path = "document.pdf"
base64_pdf = encode_pdf_to_base64(pdf_path)
data_url = f"data:application/pdf;base64,{base64_pdf}"

response = client.chat.completions.create(
    model="gemini-3.1-flash-lite-preview",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "What is this document about?"},
            {
                "type": "file",
                "file": {
                    "filename": "document.pdf",
                    "file_data": data_url
                }
            },
        ],
    }],
)

print(response.choices[0].message.content)
import fs from "fs";
import OpenAI from "openai";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const pdfPath = "document.pdf";
const pdfBuffer = fs.readFileSync(pdfPath);
const base64Pdf = pdfBuffer.toString("base64");
const dataUrl = `data:application/pdf;base64,${base64Pdf}`;

const response = await client.chat.completions.create({
    model: "gemini-3.1-flash-lite-preview",
    messages: [
        {
            role: "user",
            content: [
                { type: "text", text: "What is this document about?" },
                {
                    type: "file",
                    file: {
                        filename: "document.pdf",
                        file_data: dataUrl
                    }
                },
            ],
        },
    ],
});

console.log(response.choices[0].message.content);
# Replace YOUR_BASE64_STRING with the actual base64 string of your PDF document
curl https://api.mnnai.ru/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -d '{
    "model": "gemini-3.1-flash-lite-preview",
    "messages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "What is this document about?"
          },
          {
            "type": "file",
            "file": {
              "filename": "document.pdf",
              "file_data": "data:application/pdf;base64,YOUR_BASE64_STRING"
            }
          }
        ]
      }
    ]
  }'
import base64
from openai import OpenAI

def encode_pdf_to_base64(pdf_path):
    with open(pdf_path, "rb") as pdf_file:
        return base64.b64encode(pdf_file.read()).decode("utf-8")

client = OpenAI(
    base_url="https://api.mnnai.ru/v1",
    api_key="your-api-key"
)

pdf_path = "document.pdf"
base64_pdf = encode_pdf_to_base64(pdf_path)
data_url = f"data:application/pdf;base64,{base64_pdf}"

response = client.responses.create(
    model="gemini-3.1-flash-lite-preview",
    input=[{
        "role": "user",
        "content": [
            {"type": "input_text", "text": "What is this document about?"},
            {
                "type": "input_file",
                "file": {
                    "filename": "document.pdf",
                    "file_data": data_url
                }
            },
        ],
    }],
)

print(response.output_text)
import fs from "fs";
import OpenAI from "openai";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const pdfPath = "document.pdf";
const pdfBuffer = fs.readFileSync(pdfPath);
const base64Pdf = pdfBuffer.toString("base64");
const dataUrl = `data:application/pdf;base64,${base64Pdf}`;

const response = await client.responses.create({
    model: "gemini-3.1-flash-lite-preview",
    input: [
        {
            role: "user",
            content: [
                { type: "input_text", text: "What is this document about?" },
                {
                    type: "input_file",
                    file: {
                        filename: "document.pdf",
                        file_data: dataUrl
                    }
                },
            ],
        },
    ],
});

console.log(response.output_text);
# Replace YOUR_BASE64_STRING with the actual base64 string of your PDF document
curl https://api.mnnai.ru/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -d '{
    "model": "gemini-3.1-flash-lite-preview",
    "input": [
      {
        "role": "user",
        "content": [
          {
            "type": "input_text",
            "text": "What is this document about?"
          },
          {
            "type": "input_file",
            "file": {
              "filename": "document.pdf",
              "file_data": "data:application/pdf;base64,YOUR_BASE64_STRING"
            }
          }
        ]
      }
    ]
  }'

{{ t('h1Stt') }}

{{ t('sttIntro') }}

from openai import OpenAI

client = OpenAI(
    base_url="https://api.mnnai.ru/v1"
)

with open("audio.mp3", "rb") as audio_file:
    transcription = client.audio.transcriptions.create(
        model="whisper-1",
        file=audio_file
    )

print(transcription.text)
import OpenAI from "openai";
import fs from "fs";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const transcription = await client.audio.transcriptions.create({
    model: "whisper-1",
    file: fs.createReadStream("audio.mp3"),
});

console.log(transcription.text);
curl https://api.mnnai.ru/v1/audio/transcriptions \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -F model="whisper-1" \
  -F file="@audio.mp3"

{{ t('h1Translations') }}

{{ t('translationsIntro') }}

from openai import OpenAI

client = OpenAI(
    base_url="https://api.mnnai.ru/v1"
)

with open("audio.mp3", "rb") as audio_file:
    transcription = client.audio.translations.create(
        model="whisper-1",
        file=audio_file
    )

print(transcription.text)
import OpenAI from "openai";
import fs from "fs";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const translation = await client.audio.translations.create({
    model: "whisper-1",
    file: fs.createReadStream("audio.mp3"),
});

console.log(translation.text);
curl https://api.mnnai.ru/v1/audio/translations \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -F model="whisper-1" \
  -F file="@audio.mp3"

{{ t('h1Tts') }}

{{ t('ttsIntro') }}

from openai import OpenAI
from pathlib import Path

client = OpenAI(
    base_url="https://api.mnnai.ru/v1"
)

speech_file_path = Path(__file__).parent / "speech.mp3"

with client.audio.speech.with_streaming_response.create(
    model="qwen-3-tts-flash",
    voice="Cherry",
    input="The quick brown fox jumped over the lazy dog."
) as response:
    response.stream_to_file(speech_file_path)
import OpenAI from "openai";
import fs from "fs";
import path from "path";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const speechFile = path.resolve("./speech.mp3");

const mp3 = await client.audio.speech.create({
    model: "qwen-3-tts-flash",
    voice: "Cherry",
    input: "The quick brown fox jumped over the lazy dog.",
});

const buffer = Buffer.from(await mp3.arrayBuffer());
await fs.promises.writeFile(speechFile, buffer);
curl https://api.mnnai.ru/v1/audio/speech \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "qwen-3-tts-flash",
    "input": "The quick brown fox jumped over the lazy dog.",
    "voice": "Cherry"
  }' \
  --output speech.mp3

{{ t('h1Moderation') }}

{{ t('moderationIntro') }}

from openai import OpenAI

client = OpenAI(
    base_url="https://api.mnnai.ru/v1"
)

response = client.moderations.create(input="This is a safe sentence.")
print(response.results[0].flagged)
import OpenAI from "openai";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const moderation = await client.moderations.create({ input: "This is a safe sentence." });

console.log(moderation.results[0].flagged);
curl https://api.mnnai.ru/v1/moderations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -d '{
    "input": "This is a safe sentence."
  }'

{{ t('h1Embedding') }}

{{ t('embeddingIntro') }}

from openai import OpenAI

client = OpenAI(
    base_url="https://api.mnnai.ru/v1"
)

response = client.embeddings.create(
  model="text-embedding-3-small",
  input="The quick brown fox jumps over the lazy dog"
)

print(response.data[0].embedding)
import OpenAI from "openai";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const embedding = await client.embeddings.create({
    model: "text-embedding-3-small",
    input: "The quick brown fox jumps over the lazy dog",
});

console.log(embedding.data[0].embedding);
curl https://api.mnnai.ru/v1/embeddings \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -d '{
    "input": "The quick brown fox jumps over the lazy dog",
    "model": "text-embedding-3-small"
  }'

{{ t('h1FunctionCalling') }}

{{ t('functionCallingIntro') }}

{{ showResponses ? t('apiChatCompletions') : t('apiResponses') }}
from openai import OpenAI

client = OpenAI(
    base_url="https://api.mnnai.ru/v1"
)

tools = [{
    "type": "function",
    "function": {
        "name": "get_weather",
        "description": "Get current temperature for a given location.",
        "parameters": {
            "type": "object",
            "properties": {
                "location": {
                    "type": "string",
                    "description": "City and country e.g. Bogotá, Colombia"
                }
            },
            "required": [
                "location"
            ],
            "additionalProperties": False
        },
        "strict": True
    }
}]

completion = client.chat.completions.create(
    model="gpt-5",
    messages=[{"role": "user", "content": "What is the weather like in Paris today?"}],
    tools=tools
)

print(completion.choices[0].message.tool_calls)
import OpenAI from "openai";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const tools = [
    {
        type: "function",
        function: {
            name: "get_weather",
            description: "Get current temperature for a given location.",
            parameters: {
                type: "object",
                properties: {
                    location: {
                        type: "string",
                        description: "City and country e.g. Bogotá, Colombia",
                    },
                },
                required: ["location"],
                additionalProperties: false,
            },
            strict: true,
        },
    },
];

const completion = await client.chat.completions.create({
    model: "gpt-5",
    messages: [{ role: "user", content: "What is the weather like in Paris today?" }],
    tools: tools,
});

console.log(completion.choices[0].message.tool_calls);
curl https://api.mnnai.ru/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -d '{
    "model": "gpt-5",
    "messages": [{"role": "user", "content": "What is the weather like in Paris today?"}],
    "tools": [
      {
        "type": "function",
        "function": {
          "name": "get_weather",
          "description": "Get current temperature for a given location.",
          "parameters": {
            "type": "object",
            "properties": {
              "location": {
                "type": "string",
                "description": "City and country e.g. Bogotá, Colombia"
              }
            },
            "required": ["location"],
            "additionalProperties": false
          },
          "strict": true
        }
      }
    ]
  }'
from openai import OpenAI

client = OpenAI(
    base_url="https://api.mnnai.ru/v1"
)

tools = [{
    "type": "function",
    "name": "get_weather",
    "description": "Get current temperature for a given location.",
    "parameters": {
        "type": "object",
        "properties": {
            "location": {
                "type": "string",
                "description": "City and country e.g. Bogotá, Colombia"
            }
        },
        "required": [
            "location"
        ],
        "additionalProperties": False
    }
}]

response = client.responses.create(
    model="gpt-5",
    input=[{"role": "user", "content": "What is the weather like in Paris today?"}],
    tools=tools
)

print(response.output)
import OpenAI from "openai";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const tools = [
    {
        type: "function",
        name: "get_weather",
        description: "Get current temperature for a given location.",
        parameters: {
            type: "object",
            properties: {
                location: {
                    type: "string",
                    description: "City and country e.g. Bogotá, Colombia",
                },
            },
            required: ["location"],
            additionalProperties: false,
        },
    },
];

const response = await client.responses.create({
    model: "gpt-5",
    input: [{ role: "user", content: "What is the weather like in Paris today?" }],
    tools: tools,
});

console.log(response.output);
curl https://api.mnnai.ru/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -d '{
    "model": "gpt-5",
    "input": [{"role": "user", "content": "What is the weather like in Paris today?"}],
    "tools": [
      {
        "type": "function",
        "name": "get_weather",
        "description": "Get current temperature for a given location.",
        "parameters": {
          "type": "object",
          "properties": {
            "location": {
              "type": "string",
              "description": "City and country e.g. Bogotá, Colombia"
            }
          },
          "required": ["location"],
          "additionalProperties": false
        }
      }
    ]
  }'

{{ t('functionCallingNoteStrong') }} {{ t('functionCallingNoteBody') }} {{ t('functionCallingDashboardLink') }} {{ t('functionCallingNoteTail') }}

{{ t('h1WebAccess') }}

{{ t('webAccessIntro') }}

from openai import OpenAI

client = OpenAI(
    base_url="https://api.mnnai.ru/v1"
)

response = client.responses.create(
    model="gpt-4o",
    tools=[{"type": "web_search_preview"}],
    input="What was a positive news story from today?"
)

print(response.output_text)
import OpenAI from "openai";

const client = new OpenAI({
    baseURL: "https://api.mnnai.ru/v1",
    apiKey: "your-api-key"
});

const response = await client.responses.create({
    model: "gpt-4o",
    tools: [{ type: "web_search_preview" }],
    input: "What was a positive news story from today?",
});

console.log(response.output_text);
curl https://api.mnnai.ru/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $MNN_API_KEY" \
  -d '{
    "model": "gpt-4o",
    "tools": [{"type": "web_search_preview"}],
    "input": "What was a positive news story from today?"
  }'

{{ t('webAccessNoteStrong') }} {{ t('webAccessNoteBody') }} deepseek-v3-0324-search.

{{ t('h1AnthropicSdk') }}

{{ t('anthropicSdkIntro') }}

import anthropic

client = anthropic.Anthropic(
    base_url="https://api.mnnai.ru/",
    api_key="your-mnn-api-key"
)

message = client.messages.create(
    model="claude-4.6-sonnet",
    max_tokens=1024,
    messages=[
        {"role": "user", "content": "Hello, Claude"}
    ]
)

print(message.content[0].text)
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
    baseURL: "https://api.mnnai.ru/",
    apiKey: "your-mnn-api-key"
});

const message = await client.messages.create({
    model: "claude-4.6-sonnet",
    max_tokens: 1024,
    messages: [
        { role: "user", content: "Hello, Claude" }
    ],
});

console.log(message.content[0].text);
curl https://api.mnnai.ru/v1/messages \
  -H "Content-Type: application/json" \
  -H "x-api-key: $MNN_API_KEY" \
  -d '{
    "model": "claude-4.6-sonnet",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "Hello, Claude"}]
  }'

{{ t('anthropicReasoningTitle') }}

{{ t('anthropicReasoningDescBefore') }} output_config. {{ t('anthropicReasoningDescBetween') }} effort_types {{ t('anthropicReasoningDescAfter') }} /v1/models.

message = client.messages.create(
    model="claude-4.6-sonnet",
    max_tokens=1024,
    output_config={"effort": "medium"},
    messages=[{"role": "user", "content": "Solve this step by step."}]
)

{{ t('h1ClaudeCode') }}

{{ t('claudeCodeIntro') }}

{{ t('h2Setup') }}

  1. {{ t('claudeCodeSetup1Before') }} npm install -g @anthropic-ai/claude-code
  2. {{ t('claudeCodeSetup2') }}
export ANTHROPIC_BASE_URL="https://api.mnnai.ru/v1"
export ANTHROPIC_API_KEY="your-mnn-api-key"

{{ t('claudeCodeRunItBefore') }} claude {{ t('claudeCodeRunItAfter') }}

{{ t('h1Codex') }}

{{ t('codexIntro') }}

{{ t('h2Setup') }}

  1. {{ t('codexSetup1Before') }} npm install -g @openai/codex
  2. {{ t('codexSetup2') }} ~/.codex/config.toml
model = "gpt-5.6-sol"
model_provider = "custom"
model_reasoning_effort = "low"
service_tier = "default"
approval_policy = "on-request"
sandbox_mode = "workspace-write"

[model_providers.custom]
name = "mnn"
base_url = "https://api.mnnai.ru/v1"
env_key = "OPENAI_API_KEY"
requires_openai_auth = false
wire_api = "responses"
  1. {{ t('codexSetup3') }}
export OPENAI_API_KEY="your-mnn-api-key"

{{ t('codexRunItBefore') }} codex {{ t('codexRunItAfter') }}

{{ t('h1Opencode') }}

{{ t('opencodeIntro') }}

{{ t('h2Setup') }}

  1. {{ t('opencodeSetup1Before') }} curl -fsSL https://opencode.ai/install | bash
  2. {{ t('opencodeSetup2') }}
source ~/.zshrc
nano ~/.config/opencode/config.json
{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "my_custom_provider": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "MNN",
      "options": {
        "baseURL": "https://api.mnnai.ru/v1"
      },
      "models": {
        "glm-5.1": {
          "name": "GLM 5.1"
        },
        "grok-4.20": {
          "name": "Grok 4.20"
        },
        "gpt-5.4": {
          "name": "GPT 5.4"
        },
        "claude-4.6-sonnet": {
          "name": "Claude 4.6 Sonnet"
        }
      }
    }
  }
}
                

{{ t('opencodeRunItBefore') }} opencode {{ t('opencodeRunItAfter') }}