modele

Llama 3.1 Nemotron Safety Guard 8B v3

Markdown · JSON

Llama 3.1 Nemotron Safety Guard 8B v3

Nemotron Safety Guard v3 sprawdza wiadomości użytkowników i odpowiedzi modelu według zadanej taksonomii ryzyk. Zwraca JSON z osobnymi ocenami bezpieczeństwa i kategoriami naruszeń.

O modelu

Ten opis przedstawia możliwości modelu. Dane wejściowe, wyniki i opcje dostępne w Ailoot podano poniżej dla wybranej metody.

Sprawdzanie obu stron rozmowy

Llama 3.1 Nemotron Safety Guard 8B v3 został opracowany przez NVIDIA do moderowania interakcji człowieka z modelem językowym. Można przekazać samą wiadomość użytkownika lub uzupełnić ją odpowiedzią asystenta, także obejmującą kilka wypowiedzi. Model określa bezpieczeństwo każdej strony: niebezpieczne żądanie i prawidłowa odmowa asystenta otrzymują różne oceny. Pozwala to sprawdzać wejście przed generowaniem i osobno analizować już przygotowaną odpowiedź.

Wynik ma postać JSON. Obowiązkowe pole User Safety zawiera safe lub unsafe. Pole Response Safety pojawia się, gdy wejście obejmuje odpowiedź asystenta. Przy wykryciu naruszenia dodawane jest Safety Categories z kategoriami oddzielonymi przecinkami. Wynik ten nadaje się do filtrowania programowego i przekazywania spornego przypadku do dodatkowej weryfikacji.

Kategorie i kontekst kulturowy

Instrukcja określa reguły i nazwy kategorii używanych do sprawdzania. Opublikowana taksonomia obejmuje 23 grupy ryzyk: między innymi przemoc, groźby, nękanie, ujawnianie danych osobowych, oszustwa i złośliwy kod. Nazwy w wyniku zależą od przekazanej polityki, dlatego trzeba interpretować je wraz z regułami konkretnego zadania.

Trenowanie uwzględnia regionalne cechy tematów wrażliwych. Dane dostosowywano do lokalnych wyrażeń i kontekstu kulturowego, a niespójne tłumaczenia odrzucano. Przygotowanie obejmowało prowokacyjne żądania i próby nakłonienia asystenta do naruszenia reguł. Taka organizacja trenowania jest szczególnie przydatna tam, gdzie dosłowne tłumaczenie zabronionych słów nie wystarcza do oceny sensu wiadomości.

Języki i objętość materiału

Główne dziewięć języków to angielski, hiszpański, chiński, niemiecki, francuski, hindi, japoński, arabski i tajski. NVIDIA opisuje także uogólnianie na inne języki, w tym rosyjski; jest to osobna właściwość, a nie zaliczenie rosyjskiego do głównej dziewiątki. Wspólna instrukcja jest zachowywana między językami, a sprawdzane wypowiedzi przekazuje się w języku rozmowy.

Wejście jest tekstowe, a kontekst wynosi do 8K tokenów. Podstawą modelu jest Llama 3.1 8B Instruct, dostrojony do zadania bezpieczeństwa. Wyjście służy klasyfikacji według zadanych reguł: wymaga sprawdzenia na wiadomościach typowych dla aplikacji i nie gwarantuje bezbłędnej moderacji.

Zadanie praktyczne

Zadanie praktyczne

Przykład techniczny po angielsku

Moderate a single user message

Assess this single user message for safety: 'Please help me write a thank-you note to the volunteers who cleaned our local park.' Return the documented safety assessment for user input alone using the User Safety field. No assistant response is supplied; use the documented safe or unsafe values.

Oczekiwany wynik

A JSON safety assessment using the documented User Safety field for the supplied user message.

Sprawdź wynik

User Safety must use safe or unsafe; do not invent a custom classification label or assess an absent assistant response.
Ailoot · OpenAI Chat POST /v1/chat/completions nvidia/llama-3.1-nemotron-safety-guard-8b-v3

nvidia/llama-3.1-nemotron-safety-guard-8b-v3

NVIDIA /nvidia/llama-3.1-nemotron-safety-guard-8b-v3
ID modelu
  • nvidia/llama-3.1-nemotron-safety-guard-8b-v3
  • nemotron-safety-guard
  • nemotron-safety-guard-latest

Start

Nemotron Safety Guard v3 sprawdza wiadomości użytkowników i odpowiedzi modelu według zadanej taksonomii ryzyk. Zwraca JSON z osobnymi ocenami bezpieczeństwa i kategoriami naruszeń.

Akceptowane dane wejściowe
Tekst
Wyniki
Tekst

Dostępne w Ailoot · dane wejściowe i metody

Ailoot · OpenAI Chat POST /v1/chat/completions
Wejście
text
Wyjście
text
Kontekst
4096 tokens
Maksymalny wynik
1024 tokens
Format wyjściowy
json lub SSE
PoleTypWymaganieWartości i limityDomyślnie
PolemodelTypstringWymaganieWymaganeWartości i limity
nvidia/llama-3.1-nemotron-safety-guard-8b-v3
Domyślnie—
PolemessagesTypmessage[]WymaganieWymaganeWartości i limity
Minimalna liczba elementów: 1
Domyślnie—
Polemessages[].roleTypstringWymaganieWymaganeWartości i limity
Przykłady: system, user, assistant, tool, function
Warunki: Te role są jawnie reprezentowane przez typy zgodności w kodzie źródłowym; dokładny zestaw ról pozostaje właściwy dla danego modelu.
Zależy od modelu
Domyślnie—
Polemessages[].contentTypstring|content_part[]|nullWymaganieOpcjonalneWartości i limityDomyślnie—
Polemessages[].tool_callsTyptool_call[]WymaganieOpcjonalneWartości i limityDomyślnie—
Polemessages[].tool_call_idTypstringWymaganieOpcjonalneWartości i limity
Obowiązuje, gdy: role=tool; użyj rzeczywiście zwróconego ID
Domyślnie—
Polemessages[].nameTypstringWymaganieOpcjonalneWartości i limityDomyślnie—
Polemessages[].reasoning_contentTypstringWymaganieOpcjonalneWartości i limity
Obowiązuje, gdy: Przekazuj z powrotem rzeczywiście zwróconą treść rozumowania, gdy ten model jej używa
Domyślnie—
Polemessages[].reasoning_detailsTypobject|arrayWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Polemax_tokensTypintegerWymaganieOpcjonalneWartości i limity
Minimum: 1
Zależy od modelu
Domyślnie—
Polemax_completion_tokensTypintegerWymaganieOpcjonalneWartości i limity
Minimum: 1
Zależy od modelu
Domyślnie—
PolestreamTypbooleanWymaganieOpcjonalneWartości i limityDomyślniefalse
Polestream_options.include_usageTypbooleanWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
PoletemperatureTypnumberWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poletop_pTypnumberWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
PolestopTypstring|string[]WymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
PoletoolsTypfunction_tool[]WymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poletools[].typeTypstringWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poletools[].function.nameTypstringWymaganieWymaganeWartości i limity
Obowiązuje, gdy: udostępnione narzędzie funkcji
Domyślnie—
Poletools[].function.descriptionTypstringWymaganieOpcjonalneWartości i limityDomyślnie—
Poletools[].function.parametersTypJSON_schemaWymaganieOpcjonalneWartości i limityDomyślnie—
Poletool_choiceTypstring|objectWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poleparallel_tool_callsTypbooleanWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poleresponse_formatTypobjectWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Polereasoning_effortTypstringWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
PolereasoningTypobjectWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poleservice_tierTypstringWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
PoleinstructionsTypstringWymaganieOpcjonalneWartości i limity
Pole zgodności
Domyślnie—
PolefunctionsTypfunction[]WymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Polefunction_callTypstring|objectWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poleprompt_cache_optionsTypobjectWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Kombinacje materiałów wejściowych

Tekst · tekst UTF8

messages[].content

Parametry i cykl życia metody
ParametrKontrakt
Parametrmaterial_typesKontrakttext
ParametrrequiredKontraktmodel, messages
Parametroptional_controlsKontraktnull
Parametrcontent_typeKontraktapplication/json
Parametrtext_file_materialKontraktrzeczywista treść UTF-8 wstawiona jako tekst; ID/URLs plików wymagają oddzielnej, dokładnie określonej obsługi

Cykl życia: exact retained published method

Struktury metod i ID są dokładne; możliwości dostawcy są odrębne od dopuszczenia żądania.

Cennik

Stawki metod Ailoot

Ailoot OpenAI ChatPOST /v1/chat/completions
Wejście
0,0002 USD / 1K
Wyjście
0,0002 USD / 1K
Odczyt cache
0,0002 USD / 1K
Zapis do cache
0,0002 USD / 1K
Zapis do cache, 5 min
0,0002 USD / 1K tokens

Ailoot rezerwuje szacowaną kwotę przed żądaniem. Po otrzymaniu wyniku rozlicza ostateczną opłatę według zmierzonego użycia. Rozliczenie strumieniowania korzysta z końcowego rekordu użycia. Jak działają rezerwacja i rozliczenie →

Przykładowe żądania

Ailoot · OpenAI Chat

Przykład tekstowyPython SDKNode.js SDKStrumień w Pythonie
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_TEXT_FILE:?Set your actual UTF-8 source-material file}"
export AILOOT_TEXT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "nvidia/llama-3.1-nemotron-safety-guard-8b-v3", "messages": []}')
f=Path(os.environ["AILOOT_TEXT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 source material")
text=f.read_text(encoding="utf-8")
if not text.strip():raise SystemExit("Source material must contain text")
p["messages"]=[{"role":"user","content":"Summarize this material and quote supporting source passages.\n\n"+text}]
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/chat/completions \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path
print(json.dumps(json.loads(Path("result.json").read_text()),ensure_ascii=False,indent=2))
PY_RESULT
from openai import OpenAI
import os

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client = OpenAI(base_url="https://api.ailoot.ai/v1", api_key=os.environ["AILOOT_API_KEY"], max_retries=0)
resp = client.chat.completions.create(
    model="nvidia/llama-3.1-nemotron-safety-guard-8b-v3",
    messages=[{"role": "user", "content": "Explain the difference between an observation and a hypothesis in three sentences."}],
)
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

save_result(resp.to_dict(mode="json"))
import OpenAI from "openai";

if (!process.env.AILOOT_API_KEY?.trim()) throw new Error("Set AILOOT_API_KEY before making a request");
const client = new OpenAI({ baseURL: "https://api.ailoot.ai/v1", apiKey: process.env.AILOOT_API_KEY, maxRetries: 0 });
const resp = await client.chat.completions.create({
  model: "nvidia/llama-3.1-nemotron-safety-guard-8b-v3",
  messages: [{ role: "user", content: "Explain the difference between an observation and a hypothesis in three sentences." }],
});
import { writeFileSync } from "node:fs";

function saveResult(data, stem = "result") {
  writeFileSync(stem + ".json", JSON.stringify(data, null, 2));
  console.log(JSON.stringify(data, null, 2));
  const saveBlob = (encoded, suffix, label) => {
    const raw = Buffer.from(encoded, "base64");
    const ext = raw.subarray(0,8).equals(Buffer.from([137,80,78,71,13,10,26,10])) ? "png" : raw[0]===255 && raw[1]===216 ? "jpg" : raw.subarray(0,4).toString()==="RIFF" && raw.subarray(8,12).toString()==="WEBP" ? "webp" : suffix;
    const file = `${stem}-${label}.${ext}`;
    writeFileSync(file, raw); console.log("Saved", file);
  };
  for (const [i, block] of (data.content || []).entries()) console.log("Content", i, JSON.stringify(block));
  for (const choice of data.choices || []) console.log("Choice", choice.index, JSON.stringify(choice.message || choice.delta || {}));
  for (const [i, item] of (data.output || []).entries()) {
    console.log("Output", i, JSON.stringify(item));
    if (item.type === "image_generation_call" && item.result) saveBlob(item.result, item.output_format || "bin", `output-${i}`);
  }
  for (const [ci, candidate] of (data.candidates || []).entries()) {
    for (const [pi, part] of (candidate.content?.parts || []).entries()) {
      console.log("Candidate/part", ci, pi, JSON.stringify(part));
      const blob = part.inlineData || part.inline_data;
      if (blob?.data) {
        const mime = blob.mimeType || blob.mime_type;
        const suffix = ({"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"})[mime] || "bin";
        saveBlob(blob.data, suffix, `candidate-${ci}-part-${pi}`);
      }
    }
  }
}

saveResult(resp);
from openai import OpenAI
import os
from pathlib import Path

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

with client.chat.completions.stream(model='nvidia/llama-3.1-nemotron-safety-guard-8b-v3',messages=[{"role":"user","content":"Explain observations and hypotheses in three sentences."}]) as stream:
    with Path("stream-events.jsonl").open("w",encoding="utf-8") as log:
        for event in stream:
            payload=event.to_dict(mode="json")
            log.write(json.dumps(payload,ensure_ascii=False)+"\n"); log.flush()
            print(json.dumps(payload,ensure_ascii=False))
    final=stream.get_final_completion()
    save_result(final.to_dict(mode="json"),"stream-result")

Odbieranie i zapisywanie wyników

Ailoot · OpenAI Chat

json lub SSE

Zachowaj wszystkie ukończone wyniki

Zachowaj każdą kompletną zwróconą odpowiedź, plik i część treści.

Zachowaj każdy wariant i jego treść/wywołania narzędzi/rozumowanie. W SSE składaj przyrosty według indeksu wariantu/narzędzia, zachowując końcowy powód zakończenia i dane użycia.

Jeśli trzeba sprawdzić pierwotną odpowiedź

Zachowaj ID i nagłówki żądań/odpowiedzi. Nie udostępniono ogólnego URL pobierania zadania tekstowego.

Pola odpowiedzi
PoleTyp
Polechoices[].indexTypinteger
Polechoices[].message.contentTypstring|null
Polechoices[].message.tool_callsTyptool_call[]
Polechoices[].message.reasoning_contentTypstring
Polechoices[].message.reasoning_detailsTypobject|array
Polechoices[].finish_reasonTypstring|null
PoleusageTypobject
Błędy i dalsze kroki
OdpowiedźWarunekNastępny krok
Odpowiedź400 · invalid_request_errorWarunekNieprawidłowe wymagane pola, sposób reprezentacji materiału lub wartość parametruNastępny krokPopraw wskazane pola przed nowym żądaniem utworzenia.

Aliasy

Aliasy modelu

Ailoot nvidia/llama-3.1-nemotron-safety-guard-8b-v3, nemotron-safety-guard, nemotron-safety-guard-latest

Aliasy ścieżek metod

Użyj ścieżek metod podanych powyżej.

Powiązane ID modeli

nvidia/llama-3.1-nemotron-safety-guard-8b-v3, nemotron-safety-guard, nemotron-safety-guard-latest

Ailoot · OpenAI Chat POST /v1/chat/completions nemotron-safety-guard

nemotron-safety-guard

NVIDIA /nemotron-safety-guard
ID modelu
  • nvidia/llama-3.1-nemotron-safety-guard-8b-v3
  • nemotron-safety-guard
  • nemotron-safety-guard-latest

Start

Nemotron Safety Guard v3 sprawdza wiadomości użytkowników i odpowiedzi modelu według zadanej taksonomii ryzyk. Zwraca JSON z osobnymi ocenami bezpieczeństwa i kategoriami naruszeń.

Akceptowane dane wejściowe
Tekst
Wyniki
Tekst

Dostępne w Ailoot · dane wejściowe i metody

Ailoot · OpenAI Chat POST /v1/chat/completions
Wejście
text
Wyjście
text
Kontekst
4096 tokens
Maksymalny wynik
1024 tokens
Format wyjściowy
json lub SSE
PoleTypWymaganieWartości i limityDomyślnie
PolemodelTypstringWymaganieWymaganeWartości i limity
nemotron-safety-guard
Domyślnie—
PolemessagesTypmessage[]WymaganieWymaganeWartości i limity
Minimalna liczba elementów: 1
Domyślnie—
Polemessages[].roleTypstringWymaganieWymaganeWartości i limity
Przykłady: system, user, assistant, tool, function
Warunki: Te role są jawnie reprezentowane przez typy zgodności w kodzie źródłowym; dokładny zestaw ról pozostaje właściwy dla danego modelu.
Zależy od modelu
Domyślnie—
Polemessages[].contentTypstring|content_part[]|nullWymaganieOpcjonalneWartości i limityDomyślnie—
Polemessages[].tool_callsTyptool_call[]WymaganieOpcjonalneWartości i limityDomyślnie—
Polemessages[].tool_call_idTypstringWymaganieOpcjonalneWartości i limity
Obowiązuje, gdy: role=tool; użyj rzeczywiście zwróconego ID
Domyślnie—
Polemessages[].nameTypstringWymaganieOpcjonalneWartości i limityDomyślnie—
Polemessages[].reasoning_contentTypstringWymaganieOpcjonalneWartości i limity
Obowiązuje, gdy: Przekazuj z powrotem rzeczywiście zwróconą treść rozumowania, gdy ten model jej używa
Domyślnie—
Polemessages[].reasoning_detailsTypobject|arrayWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Polemax_tokensTypintegerWymaganieOpcjonalneWartości i limity
Minimum: 1
Zależy od modelu
Domyślnie—
Polemax_completion_tokensTypintegerWymaganieOpcjonalneWartości i limity
Minimum: 1
Zależy od modelu
Domyślnie—
PolestreamTypbooleanWymaganieOpcjonalneWartości i limityDomyślniefalse
Polestream_options.include_usageTypbooleanWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
PoletemperatureTypnumberWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poletop_pTypnumberWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
PolestopTypstring|string[]WymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
PoletoolsTypfunction_tool[]WymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poletools[].typeTypstringWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poletools[].function.nameTypstringWymaganieWymaganeWartości i limity
Obowiązuje, gdy: udostępnione narzędzie funkcji
Domyślnie—
Poletools[].function.descriptionTypstringWymaganieOpcjonalneWartości i limityDomyślnie—
Poletools[].function.parametersTypJSON_schemaWymaganieOpcjonalneWartości i limityDomyślnie—
Poletool_choiceTypstring|objectWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poleparallel_tool_callsTypbooleanWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poleresponse_formatTypobjectWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Polereasoning_effortTypstringWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
PolereasoningTypobjectWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poleservice_tierTypstringWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
PoleinstructionsTypstringWymaganieOpcjonalneWartości i limity
Pole zgodności
Domyślnie—
PolefunctionsTypfunction[]WymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Polefunction_callTypstring|objectWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poleprompt_cache_optionsTypobjectWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Kombinacje materiałów wejściowych

Tekst · tekst UTF8

messages[].content

Parametry i cykl życia metody
ParametrKontrakt
Parametrmaterial_typesKontrakttext
ParametrrequiredKontraktmodel, messages
Parametroptional_controlsKontraktnull
Parametrcontent_typeKontraktapplication/json
Parametrtext_file_materialKontraktrzeczywista treść UTF-8 wstawiona jako tekst; ID/URLs plików wymagają oddzielnej, dokładnie określonej obsługi

Cykl życia: exact retained published method

Struktury metod i ID są dokładne; możliwości dostawcy są odrębne od dopuszczenia żądania.

Cennik

Stawki metod Ailoot

Ailoot OpenAI ChatPOST /v1/chat/completions
Wejście
0,0002 USD / 1K
Wyjście
0,0002 USD / 1K
Odczyt cache
0,0002 USD / 1K
Zapis do cache
0,0002 USD / 1K
Zapis do cache, 5 min
0,0002 USD / 1K tokens

Ailoot rezerwuje szacowaną kwotę przed żądaniem. Po otrzymaniu wyniku rozlicza ostateczną opłatę według zmierzonego użycia. Rozliczenie strumieniowania korzysta z końcowego rekordu użycia. Jak działają rezerwacja i rozliczenie →

Przykładowe żądania

Ailoot · OpenAI Chat

Przykład tekstowyPython SDKNode.js SDKStrumień w Pythonie
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_TEXT_FILE:?Set your actual UTF-8 source-material file}"
export AILOOT_TEXT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "nemotron-safety-guard", "messages": []}')
f=Path(os.environ["AILOOT_TEXT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 source material")
text=f.read_text(encoding="utf-8")
if not text.strip():raise SystemExit("Source material must contain text")
p["messages"]=[{"role":"user","content":"Summarize this material and quote supporting source passages.\n\n"+text}]
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/chat/completions \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path
print(json.dumps(json.loads(Path("result.json").read_text()),ensure_ascii=False,indent=2))
PY_RESULT
from openai import OpenAI
import os

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client = OpenAI(base_url="https://api.ailoot.ai/v1", api_key=os.environ["AILOOT_API_KEY"], max_retries=0)
resp = client.chat.completions.create(
    model="nemotron-safety-guard",
    messages=[{"role": "user", "content": "Explain the difference between an observation and a hypothesis in three sentences."}],
)
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

save_result(resp.to_dict(mode="json"))
import OpenAI from "openai";

if (!process.env.AILOOT_API_KEY?.trim()) throw new Error("Set AILOOT_API_KEY before making a request");
const client = new OpenAI({ baseURL: "https://api.ailoot.ai/v1", apiKey: process.env.AILOOT_API_KEY, maxRetries: 0 });
const resp = await client.chat.completions.create({
  model: "nemotron-safety-guard",
  messages: [{ role: "user", content: "Explain the difference between an observation and a hypothesis in three sentences." }],
});
import { writeFileSync } from "node:fs";

function saveResult(data, stem = "result") {
  writeFileSync(stem + ".json", JSON.stringify(data, null, 2));
  console.log(JSON.stringify(data, null, 2));
  const saveBlob = (encoded, suffix, label) => {
    const raw = Buffer.from(encoded, "base64");
    const ext = raw.subarray(0,8).equals(Buffer.from([137,80,78,71,13,10,26,10])) ? "png" : raw[0]===255 && raw[1]===216 ? "jpg" : raw.subarray(0,4).toString()==="RIFF" && raw.subarray(8,12).toString()==="WEBP" ? "webp" : suffix;
    const file = `${stem}-${label}.${ext}`;
    writeFileSync(file, raw); console.log("Saved", file);
  };
  for (const [i, block] of (data.content || []).entries()) console.log("Content", i, JSON.stringify(block));
  for (const choice of data.choices || []) console.log("Choice", choice.index, JSON.stringify(choice.message || choice.delta || {}));
  for (const [i, item] of (data.output || []).entries()) {
    console.log("Output", i, JSON.stringify(item));
    if (item.type === "image_generation_call" && item.result) saveBlob(item.result, item.output_format || "bin", `output-${i}`);
  }
  for (const [ci, candidate] of (data.candidates || []).entries()) {
    for (const [pi, part] of (candidate.content?.parts || []).entries()) {
      console.log("Candidate/part", ci, pi, JSON.stringify(part));
      const blob = part.inlineData || part.inline_data;
      if (blob?.data) {
        const mime = blob.mimeType || blob.mime_type;
        const suffix = ({"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"})[mime] || "bin";
        saveBlob(blob.data, suffix, `candidate-${ci}-part-${pi}`);
      }
    }
  }
}

saveResult(resp);
from openai import OpenAI
import os
from pathlib import Path

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

with client.chat.completions.stream(model='nemotron-safety-guard',messages=[{"role":"user","content":"Explain observations and hypotheses in three sentences."}]) as stream:
    with Path("stream-events.jsonl").open("w",encoding="utf-8") as log:
        for event in stream:
            payload=event.to_dict(mode="json")
            log.write(json.dumps(payload,ensure_ascii=False)+"\n"); log.flush()
            print(json.dumps(payload,ensure_ascii=False))
    final=stream.get_final_completion()
    save_result(final.to_dict(mode="json"),"stream-result")

Odbieranie i zapisywanie wyników

Ailoot · OpenAI Chat

json lub SSE

Zachowaj wszystkie ukończone wyniki

Zachowaj każdą kompletną zwróconą odpowiedź, plik i część treści.

Zachowaj każdy wariant i jego treść/wywołania narzędzi/rozumowanie. W SSE składaj przyrosty według indeksu wariantu/narzędzia, zachowując końcowy powód zakończenia i dane użycia.

Jeśli trzeba sprawdzić pierwotną odpowiedź

Zachowaj ID i nagłówki żądań/odpowiedzi. Nie udostępniono ogólnego URL pobierania zadania tekstowego.

Pola odpowiedzi
PoleTyp
Polechoices[].indexTypinteger
Polechoices[].message.contentTypstring|null
Polechoices[].message.tool_callsTyptool_call[]
Polechoices[].message.reasoning_contentTypstring
Polechoices[].message.reasoning_detailsTypobject|array
Polechoices[].finish_reasonTypstring|null
PoleusageTypobject
Błędy i dalsze kroki
OdpowiedźWarunekNastępny krok
Odpowiedź400 · invalid_request_errorWarunekNieprawidłowe wymagane pola, sposób reprezentacji materiału lub wartość parametruNastępny krokPopraw wskazane pola przed nowym żądaniem utworzenia.

Aliasy

Aliasy modelu

Ailoot nvidia/llama-3.1-nemotron-safety-guard-8b-v3, nemotron-safety-guard, nemotron-safety-guard-latest

Aliasy ścieżek metod

Użyj ścieżek metod podanych powyżej.

Powiązane ID modeli

nvidia/llama-3.1-nemotron-safety-guard-8b-v3, nemotron-safety-guard, nemotron-safety-guard-latest

Ailoot · OpenAI Chat POST /v1/chat/completions nemotron-safety-guard-latest

nemotron-safety-guard-latest

NVIDIA /nemotron-safety-guard-latest
ID modelu
  • nvidia/llama-3.1-nemotron-safety-guard-8b-v3
  • nemotron-safety-guard
  • nemotron-safety-guard-latest

Start

Nemotron Safety Guard v3 sprawdza wiadomości użytkowników i odpowiedzi modelu według zadanej taksonomii ryzyk. Zwraca JSON z osobnymi ocenami bezpieczeństwa i kategoriami naruszeń.

Akceptowane dane wejściowe
Tekst
Wyniki
Tekst

Dostępne w Ailoot · dane wejściowe i metody

Ailoot · OpenAI Chat POST /v1/chat/completions
Wejście
text
Wyjście
text
Kontekst
4096 tokens
Maksymalny wynik
1024 tokens
Format wyjściowy
json lub SSE
PoleTypWymaganieWartości i limityDomyślnie
PolemodelTypstringWymaganieWymaganeWartości i limity
nemotron-safety-guard-latest
Domyślnie—
PolemessagesTypmessage[]WymaganieWymaganeWartości i limity
Minimalna liczba elementów: 1
Domyślnie—
Polemessages[].roleTypstringWymaganieWymaganeWartości i limity
Przykłady: system, user, assistant, tool, function
Warunki: Te role są jawnie reprezentowane przez typy zgodności w kodzie źródłowym; dokładny zestaw ról pozostaje właściwy dla danego modelu.
Zależy od modelu
Domyślnie—
Polemessages[].contentTypstring|content_part[]|nullWymaganieOpcjonalneWartości i limityDomyślnie—
Polemessages[].tool_callsTyptool_call[]WymaganieOpcjonalneWartości i limityDomyślnie—
Polemessages[].tool_call_idTypstringWymaganieOpcjonalneWartości i limity
Obowiązuje, gdy: role=tool; użyj rzeczywiście zwróconego ID
Domyślnie—
Polemessages[].nameTypstringWymaganieOpcjonalneWartości i limityDomyślnie—
Polemessages[].reasoning_contentTypstringWymaganieOpcjonalneWartości i limity
Obowiązuje, gdy: Przekazuj z powrotem rzeczywiście zwróconą treść rozumowania, gdy ten model jej używa
Domyślnie—
Polemessages[].reasoning_detailsTypobject|arrayWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Polemax_tokensTypintegerWymaganieOpcjonalneWartości i limity
Minimum: 1
Zależy od modelu
Domyślnie—
Polemax_completion_tokensTypintegerWymaganieOpcjonalneWartości i limity
Minimum: 1
Zależy od modelu
Domyślnie—
PolestreamTypbooleanWymaganieOpcjonalneWartości i limityDomyślniefalse
Polestream_options.include_usageTypbooleanWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
PoletemperatureTypnumberWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poletop_pTypnumberWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
PolestopTypstring|string[]WymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
PoletoolsTypfunction_tool[]WymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poletools[].typeTypstringWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poletools[].function.nameTypstringWymaganieWymaganeWartości i limity
Obowiązuje, gdy: udostępnione narzędzie funkcji
Domyślnie—
Poletools[].function.descriptionTypstringWymaganieOpcjonalneWartości i limityDomyślnie—
Poletools[].function.parametersTypJSON_schemaWymaganieOpcjonalneWartości i limityDomyślnie—
Poletool_choiceTypstring|objectWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poleparallel_tool_callsTypbooleanWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poleresponse_formatTypobjectWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Polereasoning_effortTypstringWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
PolereasoningTypobjectWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poleservice_tierTypstringWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
PoleinstructionsTypstringWymaganieOpcjonalneWartości i limity
Pole zgodności
Domyślnie—
PolefunctionsTypfunction[]WymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Polefunction_callTypstring|objectWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Poleprompt_cache_optionsTypobjectWymaganieOpcjonalneWartości i limity
Zależy od modelu
Domyślnie—
Kombinacje materiałów wejściowych

Tekst · tekst UTF8

messages[].content

Parametry i cykl życia metody
ParametrKontrakt
Parametrmaterial_typesKontrakttext
ParametrrequiredKontraktmodel, messages
Parametroptional_controlsKontraktnull
Parametrcontent_typeKontraktapplication/json
Parametrtext_file_materialKontraktrzeczywista treść UTF-8 wstawiona jako tekst; ID/URLs plików wymagają oddzielnej, dokładnie określonej obsługi

Cykl życia: exact retained published method

Struktury metod i ID są dokładne; możliwości dostawcy są odrębne od dopuszczenia żądania.

Cennik

Stawki metod Ailoot

Ailoot OpenAI ChatPOST /v1/chat/completions
Wejście
0,0002 USD / 1K
Wyjście
0,0002 USD / 1K
Odczyt cache
0,0002 USD / 1K
Zapis do cache
0,0002 USD / 1K
Zapis do cache, 5 min
0,0002 USD / 1K tokens

Ailoot rezerwuje szacowaną kwotę przed żądaniem. Po otrzymaniu wyniku rozlicza ostateczną opłatę według zmierzonego użycia. Rozliczenie strumieniowania korzysta z końcowego rekordu użycia. Jak działają rezerwacja i rozliczenie →

Przykładowe żądania

Ailoot · OpenAI Chat

Przykład tekstowyPython SDKNode.js SDKStrumień w Pythonie
set -eu
: "${AILOOT_API_KEY:?Set your Ailoot API key}"
: "${AILOOT_TEXT_FILE:?Set your actual UTF-8 source-material file}"
export AILOOT_TEXT_FILE
python3 - <<'PY_REQUEST'
import json,os
from pathlib import Path
p=json.loads('{"model": "nemotron-safety-guard-latest", "messages": []}')
f=Path(os.environ["AILOOT_TEXT_FILE"])
if not f.is_file():raise SystemExit("Choose your actual UTF-8 source material")
text=f.read_text(encoding="utf-8")
if not text.strip():raise SystemExit("Source material must contain text")
p["messages"]=[{"role":"user","content":"Summarize this material and quote supporting source passages.\n\n"+text}]
Path("request.json").write_text(json.dumps(p,ensure_ascii=False))
PY_REQUEST
curl --fail-with-body --silent --show-error https://api.ailoot.ai/v1/chat/completions \
  -H "Authorization: Bearer $AILOOT_API_KEY" -H 'Content-Type: application/json' \
  --data-binary @request.json -D response-headers.txt -o result.json
python3 - <<'PY_RESULT'
import json
from pathlib import Path
print(json.dumps(json.loads(Path("result.json").read_text()),ensure_ascii=False,indent=2))
PY_RESULT
from openai import OpenAI
import os

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client = OpenAI(base_url="https://api.ailoot.ai/v1", api_key=os.environ["AILOOT_API_KEY"], max_retries=0)
resp = client.chat.completions.create(
    model="nemotron-safety-guard-latest",
    messages=[{"role": "user", "content": "Explain the difference between an observation and a hypothesis in three sentences."}],
)
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

save_result(resp.to_dict(mode="json"))
import OpenAI from "openai";

if (!process.env.AILOOT_API_KEY?.trim()) throw new Error("Set AILOOT_API_KEY before making a request");
const client = new OpenAI({ baseURL: "https://api.ailoot.ai/v1", apiKey: process.env.AILOOT_API_KEY, maxRetries: 0 });
const resp = await client.chat.completions.create({
  model: "nemotron-safety-guard-latest",
  messages: [{ role: "user", content: "Explain the difference between an observation and a hypothesis in three sentences." }],
});
import { writeFileSync } from "node:fs";

function saveResult(data, stem = "result") {
  writeFileSync(stem + ".json", JSON.stringify(data, null, 2));
  console.log(JSON.stringify(data, null, 2));
  const saveBlob = (encoded, suffix, label) => {
    const raw = Buffer.from(encoded, "base64");
    const ext = raw.subarray(0,8).equals(Buffer.from([137,80,78,71,13,10,26,10])) ? "png" : raw[0]===255 && raw[1]===216 ? "jpg" : raw.subarray(0,4).toString()==="RIFF" && raw.subarray(8,12).toString()==="WEBP" ? "webp" : suffix;
    const file = `${stem}-${label}.${ext}`;
    writeFileSync(file, raw); console.log("Saved", file);
  };
  for (const [i, block] of (data.content || []).entries()) console.log("Content", i, JSON.stringify(block));
  for (const choice of data.choices || []) console.log("Choice", choice.index, JSON.stringify(choice.message || choice.delta || {}));
  for (const [i, item] of (data.output || []).entries()) {
    console.log("Output", i, JSON.stringify(item));
    if (item.type === "image_generation_call" && item.result) saveBlob(item.result, item.output_format || "bin", `output-${i}`);
  }
  for (const [ci, candidate] of (data.candidates || []).entries()) {
    for (const [pi, part] of (candidate.content?.parts || []).entries()) {
      console.log("Candidate/part", ci, pi, JSON.stringify(part));
      const blob = part.inlineData || part.inline_data;
      if (blob?.data) {
        const mime = blob.mimeType || blob.mime_type;
        const suffix = ({"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"})[mime] || "bin";
        saveBlob(blob.data, suffix, `candidate-${ci}-part-${pi}`);
      }
    }
  }
}

saveResult(resp);
from openai import OpenAI
import os
from pathlib import Path

if not os.environ.get("AILOOT_API_KEY", "").strip(): raise SystemExit("Set AILOOT_API_KEY before making a request")
client=OpenAI(base_url="https://api.ailoot.ai/v1",api_key=os.environ["AILOOT_API_KEY"],max_retries=0)
import base64, json
from pathlib import Path

def save_result(data, stem="result"):
    # Keep every field, including usage, IDs, reasoning and tool requests.
    Path(stem + ".json").write_text(json.dumps(data, ensure_ascii=False, indent=2), encoding="utf-8")
    print(json.dumps(data, ensure_ascii=False, indent=2))
    def save_blob(encoded, suffix, label):
        raw = base64.b64decode(encoded, altchars=b"-_", validate=True)
        ext = "png" if raw.startswith(b"\x89PNG\r\n\x1a\n") else "jpg" if raw.startswith(b"\xff\xd8") else "webp" if raw[:4] == b"RIFF" and raw[8:12] == b"WEBP" else suffix
        file = Path(stem + "-" + label + "." + ext)
        file.write_bytes(raw)
        print("Saved", file)
    for index, block in enumerate(data.get("content") or []):
        print("Content", index, json.dumps(block, ensure_ascii=False))
    for choice in data.get("choices") or []:
        print("Choice", choice.get("index"), json.dumps(choice.get("message", choice.get("delta", {})), ensure_ascii=False))
    for index, item in enumerate(data.get("output") or []):
        print("Output", index, json.dumps(item, ensure_ascii=False))
        if item.get("type") == "image_generation_call" and item.get("result"):
            save_blob(item["result"], item.get("output_format") or "bin", "output-" + str(index))
    for ci, candidate in enumerate(data.get("candidates") or []):
        for pi, part in enumerate((candidate.get("content") or {}).get("parts") or []):
            print("Candidate/part", ci, pi, json.dumps(part, ensure_ascii=False))
            blob = part.get("inlineData") or part.get("inline_data")
            if blob and blob.get("data"):
                mime = blob.get("mimeType") or blob.get("mime_type")
                suffix = {"image/png":"png", "image/jpeg":"jpg", "image/webp":"webp", "audio/wav":"wav", "audio/mpeg":"mp3", "video/mp4":"mp4"}.get(mime, "bin")
                save_blob(blob["data"], suffix, "candidate-" + str(ci) + "-part-" + str(pi))

with client.chat.completions.stream(model='nemotron-safety-guard-latest',messages=[{"role":"user","content":"Explain observations and hypotheses in three sentences."}]) as stream:
    with Path("stream-events.jsonl").open("w",encoding="utf-8") as log:
        for event in stream:
            payload=event.to_dict(mode="json")
            log.write(json.dumps(payload,ensure_ascii=False)+"\n"); log.flush()
            print(json.dumps(payload,ensure_ascii=False))
    final=stream.get_final_completion()
    save_result(final.to_dict(mode="json"),"stream-result")

Odbieranie i zapisywanie wyników

Ailoot · OpenAI Chat

json lub SSE

Zachowaj wszystkie ukończone wyniki

Zachowaj każdą kompletną zwróconą odpowiedź, plik i część treści.

Zachowaj każdy wariant i jego treść/wywołania narzędzi/rozumowanie. W SSE składaj przyrosty według indeksu wariantu/narzędzia, zachowując końcowy powód zakończenia i dane użycia.

Jeśli trzeba sprawdzić pierwotną odpowiedź

Zachowaj ID i nagłówki żądań/odpowiedzi. Nie udostępniono ogólnego URL pobierania zadania tekstowego.

Pola odpowiedzi
PoleTyp
Polechoices[].indexTypinteger
Polechoices[].message.contentTypstring|null
Polechoices[].message.tool_callsTyptool_call[]
Polechoices[].message.reasoning_contentTypstring
Polechoices[].message.reasoning_detailsTypobject|array
Polechoices[].finish_reasonTypstring|null
PoleusageTypobject
Błędy i dalsze kroki
OdpowiedźWarunekNastępny krok
Odpowiedź400 · invalid_request_errorWarunekNieprawidłowe wymagane pola, sposób reprezentacji materiału lub wartość parametruNastępny krokPopraw wskazane pola przed nowym żądaniem utworzenia.

Aliasy

Aliasy modelu

Ailoot nvidia/llama-3.1-nemotron-safety-guard-8b-v3, nemotron-safety-guard, nemotron-safety-guard-latest

Aliasy ścieżek metod

Użyj ścieżek metod podanych powyżej.

Powiązane ID modeli

nvidia/llama-3.1-nemotron-safety-guard-8b-v3, nemotron-safety-guard, nemotron-safety-guard-latest

FAQ · nvidia/llama-3.1-nemotron-safety-guard-8b-v3
Jakie dane wejściowe i wyniki są dostępne?

POST /v1/chat/completions · nvidia/llama-3.1-nemotron-safety-guard-8b-v3: text → text

POST /v1/chat/completions · nemotron-safety-guard: text → text

POST /v1/chat/completions · nemotron-safety-guard-latest: text → text

Jakich pól używa żądanie?

POST /v1/chat/completions · nvidia/llama-3.1-nemotron-safety-guard-8b-v3: model, messages, stream

POST /v1/chat/completions · nemotron-safety-guard: model, messages, stream

POST /v1/chat/completions · nemotron-safety-guard-latest: model, messages, stream

Jakie limity obowiązują?

POST /v1/chat/completions · nvidia/llama-3.1-nemotron-safety-guard-8b-v3: ctx: 4096; max_out: 1024; messages.min_items: 1

POST /v1/chat/completions · nemotron-safety-guard: ctx: 4096; max_out: 1024; messages.min_items: 1

POST /v1/chat/completions · nemotron-safety-guard-latest: ctx: 4096; max_out: 1024; messages.min_items: 1

Więcej szczegółów

Połącz Ailoot z Claude Code, OpenCode, Hermes albo własną aplikacją.

Firma i jej portfel projektów

Firma i jej portfel projektów: miliony klientów; miesięczna sprzedaż liczona w miliardach.

Kupuj tokeny z rabatem.

Rabat subskrypcji do regularnej pracy. Kody promocyjne — do 50% na tokeny.

Subskrypcja
Wybierz plan z rabatem do regularnych żądań.
Kod promocyjny do 50%
Wpisz kod przy zakupie. Cena zostanie przeliczona według aktualnej promocji.
Koszty w historii
Model, tokeny i kwota są zapisywane dla każdego żądania.

Wybierz subskrypcję · Sprawdź ceny modeli

Połącz API z produktem, który sprzedajesz.

SaaS, aplikacje i boty na warunkach oferty i umowy licencyjnej Ailoot. Do odsprzedaży poproś o licencję resellerską.

Aplikacja komercyjna
Wbuduj generowanie tekstu, obrazów, wideo i dźwięku w płatne funkcje usługi.
Licencja resellerska
Prześlij opis projektu i schemat dostępu. Poproś o pisemne warunki używania i odsprzedaży.
Dokumenty na stronie
Oferta, umowa licencyjna i polityka przetwarzania danych są dostępne przed połączeniem.

Poproś o licencję resellerską · Oferta i umowa licencyjna