גיין צו די אינהאַלט
צוריק צו נומער

וויסן באַזע אַוועקלייגן

צ'אט, תשובה און הודעות

3 וועג צו באַקומען אַ מאָדעל דיך, אין די 3 פאָרמאַטערז קאַנסטערז אַוועקלייגן, all running on the same models and billed the same way.

צאָלן סיום

די OpenAI צ'אט פורמט, און די אַזאַ כמעט יעדער טעלעפאָנירן סומט. send the conversation so far and get the next message back.

POST https://nymbot.ai/api/v1/chat/completions יעדער איינער האט א API Key.

רק model און messages אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל אַ מאָל supported_parametersוואָס איז געפונען ווי געפונען איז anything the model can't do at all: pictures for a model that cannot see, tools for a model that can't call them.

פעלדאוןדרושיםתיאור
modelאון Stringיאnymbot/auto און auto) פֿאַר Nymbot's routing on the standard balance, or a catalog model id such as anthropic/claude-sonnet-5 אויף די Pro סוואל. The app's short names and aliases are accepted too. May end in a די.
messagesאוןיאאון די תפקידים. system, developer (מיין איז געווען א שיטה) user, assistant און toolעס איז געווען א רשימה או רשימה. text און image_url פּאַרטייז; בילד only in user messages. input_audio און די קובץ זענען סענטימעטער.
streamבאָליאיןדערגרייכט די תשובה כפי שכתוב. סטרימינג.
stream_optionsאון אובייקטאין{"include_usage": true} עס איז געווען א סוף שלעכט און העלות.
max_tokens
max_completion_tokens
איןאיןדי מאַקסימום פון די מאַקסימום פון די מאַקסימום פון די מאַקסימום פון די מאַקסימום פון די מאַקסימום פון די מאַקסימום פון די מאַקסימום פון די מאַקסימום פון די מאַקסימום פון די מאַקסימום פון די מאַקסימום פון די מאַקסימום פון די מאַקסימום פון די מאַקסימום פון די מאַקסימום פון די מאַקסימום פון די מאַקסימום.
temperature
top_p
מספראיןאַוועקלייגן צו Controls: temperature פון 0 צו 2, top_p 0 און 1.
stopאון ער איז array.איןטקסט וואָס געגרינדעט די תשובה: אַ שרייַבן אָדער אין מאַקסימום 4 שרייַבן, יעדער אין מאַקסימום 256 סימנים. nymbot/auto.
seedאיןאיןפֿאַר Repeatable Sampling, where the model supports it.
presence_penalty
frequency_penalty
מספראיןדערגרייכט די קאָנטראָלז, יעדער פון -2 צו 2.
response_formatאון אובייקטאין{"type": "json_object"} און {"type": "json_schema", "json_schema": {…}}עס איז גענומען אין די מאָל. nymbot/auto.
tools
tool_choice
parallel_tool_calls
אַריבער, string אָדער אובייקט, booleanאיןאַוועקלייגן אַוועקלייגן. See און שיחותאון א web_search טעלעפאָנירן turn on WEB דעריבעראין מאַקסימום 128 tools and 512 KB of definitions, nested at מאַקסימום 64 levels deep; more is a 400.
reasoning_effort
reasoning
און א אובייקטאין"minimal", "low", "medium" און "high"און {"effort": "high"}. "none" און {"enabled": false} ער איז געווען. ראה רעיון.
pluginsאוןאין[{"id": "web", "max_results": 5}] דעריבער, איר קענען באַקומען אַרויף צו 10 Results.
nאיןאין1 און כל דבר אחר. 400.
logit_bias
user
metadata
און א אובייקט, א אובייקטאיןגעפונען און לא שולח. logit_bias מאַרץ אין מאַקסימום 300 טאָקן אַדס צו נומער פון -100 צו 100; user אין די מאַקסימום 256 טעג. metadata באַקומען אַרויף צו 16 string values, keys up to 64 characters and values up to 512.

התשובה איז פשוט. chat.completionאון דער העלון פון usage.cost (דאלער) און אין די nymbot און אובייקט. model און מיך [חלילה, נישט מיך - איך מיין די רעכטע] אויך נישט! message.reasoning_contentאיך בין די תשובה.

תגובה

{
  "id": "chatcmpl-5f1c0a9e27d84b3c",
  "object": "chat.completion",
  "created": 1790726400,
  "model": "anthropic/claude-sonnet-5",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "A Lightning invoice is a one-time payment request..."
      },
      "logprobs": null,
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 1240,
    "completion_tokens": 380,
    "total_tokens": 1620,
    "prompt_tokens_details": { "cached_tokens": 0 },
    "completion_tokens_details": { "reasoning_tokens": 0 },
    "cost": 0.01895
  },
  "nymbot": {
    "balance": "pro",
    "charged_credits": 0.162,
    "charged_sats": 16.2,
    "balance_credits": 412.425,
    "balance_sats": 41242.5
  }
}

finish_reason איז געגרינדעט פון וואָס איז געגרינדעט, אַזאַ ווי providers report it differently: tool_calls כ'האף די ווען (מיטן דרייווער) זאלן מארך ימים זיין. length כ'האף די ווען (מיטן דרייווער) זאלן מארך ימים זיין. content_filter כ'האף די ווען (מיטן דרייווער) זאלן מארך ימים זיין. stop אין די usage.completion_tokens_details.reasoning_tokens און ער איז תמיד 0: hidden reasoning tokens are counted, and charged, in completion_tokens.

סטאַטןאיך
400אין model און messages (missing_required_parameterאון מיך [חלילה, נישט מיך - איך מיין די רעכטע].unsupported_content(מיטן דרייווער) זאלן מארך ימים זיין.too_many_imagesכ'האף די ווען (מיטן דרייווער) זאלן מארך ימים זיין.invalid_value(מיטן דרייווער) זאלן מארך ימים זיין.invalid_image_url(מיטן דרייווער) זאלן מארך ימים זיין.unsupported_tool); n אין די 1; א :thinking עס איז געווען א באקאנטע סיבה (model_not_foundכ'האף די ווען (מיטן דרייווער) זאלן מארך ימים זיין.upstream_rejected).
402די סענטימעטער פון די מאָדעל גאַנץ cannot cover the hold.
403עס איז געווען א באקאנטע געשעפט (key_limit_reachedאון ליידער max_tokens אוּן ער האט א קאפ.
404עס איז געווען אין דעם (model_not_found).
429כ'האף די ווען (מיטן דרייווער) זאלן מארך ימים זיין.upstream_rate_limited).
502, 503און זייער מינדערוויכטיג.)upstream_errorאון זייער זייער מינדערוויכטיג.upstream_overloadedאון Retry-Afterאין די פּרייַז זענען געפירט אין די פּרייַז פֿאַר די פּרייַז.

די סטאַטן קאָדס יעדער Endpoint Shares זענען רשימה אונטער טעות.

cURL

curl https://nymbot.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $NYMBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-5",
    "messages": [
      {"role": "system", "content": "Answer in one short paragraph."},
      {"role": "user", "content": "What is a Lightning invoice?"}
    ],
    "max_tokens": 400
  }'

Python

import os
from openai import OpenAI

client = OpenAI(base_url="https://nymbot.ai/api/v1", api_key=os.environ["NYMBOT_API_KEY"])

reply = client.chat.completions.create(
    model="anthropic/claude-sonnet-5",
    messages=[
        {"role": "system", "content": "Answer in one short paragraph."},
        {"role": "user", "content": "What is a Lightning invoice?"},
    ],
    max_tokens=400,
)
print(reply.choices[0].message.content)
print(reply.usage.cost)

JavaScript

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://nymbot.ai/api/v1", apiKey: process.env.NYMBOT_API_KEY });

const reply = await client.chat.completions.create({
  model: "anthropic/claude-sonnet-5",
  messages: [
    { role: "system", content: "Answer in one short paragraph." },
    { role: "user", content: "What is a Lightning invoice?" },
  ],
  max_tokens: 400,
});
console.log(reply.choices[0].message.content);
console.log(reply.usage.cost);

סטרימינג

און "stream": true עס איז געווען א טעלעפאָנירן, און עס איז א טעלעפאָנירן און א טעלעפאָנירן. chat.completion.chunk און א data: און ער איז געגרינדעט, and the stream ends with data: [DONE]און די סיבה באה delta.reasoning_contentדי תשובה אין delta.content.

סטרימינג anything that may take more than approximately 100 seconds, such as a long answer, a large response. max_tokens או אַ ראַדינג מאָדעל. אַ באַשטימען וואָס איז ניט אַסטרימינג אַוועקלייגן אין אַוועקלייגן אַרויף צו די אַוועקלייגן, און די נעטעף צווישן איר און Nymbot קענען געבוירן אַ נייַעס קאַנטייטינג נאָך וועגן 100 סענטימעטער; די מאָדעל still finishes and what it wrote is charged, but the answer is lost. A stream sends keep-alives, so it stays open for as long as the model writes.

און Stream

data: {"id":"chatcmpl-5f1c0a9e27d84b3c","object":"chat.completion.chunk","created":1790726400,"model":"anthropic/claude-sonnet-5","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}

data: {"id":"chatcmpl-5f1c0a9e27d84b3c","object":"chat.completion.chunk","created":1790726400,"model":"anthropic/claude-sonnet-5","choices":[{"index":0,"delta":{"content":"A Lightning invoice"},"finish_reason":null}]}

: keep-alive

data: {"id":"chatcmpl-5f1c0a9e27d84b3c","object":"chat.completion.chunk","created":1790726400,"model":"anthropic/claude-sonnet-5","choices":[{"index":0,"delta":{},"finish_reason":"stop"}]}

data: {"id":"chatcmpl-5f1c0a9e27d84b3c","object":"chat.completion.chunk","created":1790726400,"model":"anthropic/claude-sonnet-5","choices":[],"usage":{"prompt_tokens":1240,"completion_tokens":380,"total_tokens":1620,"cost":0.01895},"nymbot":{"balance":"pro","charged_credits":0.162,"charged_sats":16.2,"balance_credits":412.425,"balance_sats":41242.5}}

data: [DONE]
  • געגרינדעט מיט : ס'איז דא א באקאנטע אויסדרוק being posted every 15 seconds while the model is thinking.
  • ביידע "stream_options": {"include_usage": true} צו באַקומען די אחרון בוך מעל, מיט אַ ריק choicesאון זייער זייער מינדערוויכטיג, און זייער מינדערוויכטיג. nymbot און אובייקט.
  • דער קרעדיט אַוועקלייגן נאָך דער סטרימינג. If you close the connection early, the model is not stopped: Nymbot reads the rest of the provider's stream, for up to 25 seconds, to get its token count, and you pay what the provider reports. Without that count the charge is estimated from your input and what was written, plus the entire output allowance for a model that reasons.
  • א טעות פון די ערשטער צייַט, אַזאַ 401 און 402, באקומען ווי אַ רגיל JSON מיט זייַן סטאַטן קאָד, אין ווי אַ סטאַם. An error after the stream has started arrives as a last data: {"error": {…}} עס איז געגרינדעט, and the stream ends without [DONE].
  • באַהאַנדלונג מיט Tools, and models on OpenAI's Responses transport, don't stream from the provider. They still respond with a valid stream, sent once the answer is complete.

cURL

curl -N https://nymbot.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $NYMBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "nymbot/auto",
    "stream": true,
    "stream_options": {"include_usage": true},
    "messages": [{"role": "user", "content": "Write a haiku about sats."}]
  }'

Python

import os
from openai import OpenAI

client = OpenAI(base_url="https://nymbot.ai/api/v1", api_key=os.environ["NYMBOT_API_KEY"])

stream = client.chat.completions.create(
    model="nymbot/auto",
    stream=True,
    stream_options={"include_usage": True},
    messages=[{"role": "user", "content": "Write a haiku about sats."}],
)
for chunk in stream:
    if chunk.choices:
        print(chunk.choices[0].delta.content or "", end="", flush=True)
    elif chunk.usage:
        print("\ncost:", chunk.usage.cost)

JavaScript

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://nymbot.ai/api/v1", apiKey: process.env.NYMBOT_API_KEY });

const stream = await client.chat.completions.create({
  model: "nymbot/auto",
  stream: true,
  stream_options: { include_usage: true },
  messages: [{ role: "user", content: "Write a haiku about sats." }],
});
for await (const chunk of stream) {
  if (chunk.choices.length) process.stdout.write(chunk.choices[0].delta.content || "");
  else if (chunk.usage) console.log("\ncost:", chunk.usage.cost);
}

טעלעפאָנירן

געגרינדעט אויף Functions in tools און ער האט געשריבן: איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך האָבּ איך tool די הודעה באותו tool_call_idNymbot never runs your functions; it passes the model's request back to you.

tool_choice און "auto", "none", "required" און {"type": "function", "function": {"name": "…"}}און מיך [חלילה, נישט מיך - איך מיין די רעכטע] אויך נישט!capabilities.tools(מאָצוואַנאַ Pula צו אים וועל איך בלע) 400 unsupported_tool און nymbot/auto און אויף די מעטער קאַטאַלאַטע מאָדעלס וואָס אַרבעט אויף OpenAI's Responses transport, וואָס Nymbot cannot pass tools to.

און "stream": true, אַ פאָרשלאָגן מיט Tools רירעוודיק אין אַ פּיץ און איז אז צוגעשטעלט ווי אַ נורמאַל פּרייַז סקריינד: די רוול, אַ פּרייַז געניצט יעדער Tool Call מיט זייַן אינדקס, ID, Name and Arguments, and the finish chunk. Clients who read streamed tool calls handle it as usual.

די תשובה איז, חלק

"choices": [
  {
    "index": 0,
    "message": {
      "role": "assistant",
      "content": null,
      "tool_calls": [
        {
          "id": "call_7d2e",
          "type": "function",
          "function": { "name": "get_invoice_status", "arguments": "{\"invoice_id\":\"a41f\"}" }
        }
      ]
    },
    "finish_reason": "tool_calls"
  }
]

cURL

curl https://nymbot.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $NYMBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-5",
    "messages": [{"role": "user", "content": "Has invoice a41f been paid?"}],
    "tools": [{
      "type": "function",
      "function": {
        "name": "get_invoice_status",
        "description": "Look up whether an invoice is paid.",
        "parameters": {
          "type": "object",
          "properties": {"invoice_id": {"type": "string"}},
          "required": ["invoice_id"]
        }
      }
    }]
  }'

Python

import json, os
from openai import OpenAI

client = OpenAI(base_url="https://nymbot.ai/api/v1", api_key=os.environ["NYMBOT_API_KEY"])

tools = [{
    "type": "function",
    "function": {
        "name": "get_invoice_status",
        "description": "Look up whether an invoice is paid.",
        "parameters": {
            "type": "object",
            "properties": {"invoice_id": {"type": "string"}},
            "required": ["invoice_id"],
        },
    },
}]
messages = [{"role": "user", "content": "Has invoice a41f been paid?"}]

reply = client.chat.completions.create(model="anthropic/claude-sonnet-5", messages=messages, tools=tools)
call = reply.choices[0].message.tool_calls[0]
args = json.loads(call.function.arguments)

messages.append(reply.choices[0].message)
messages.append({"role": "tool", "tool_call_id": call.id, "content": json.dumps({"paid": True})})

final = client.chat.completions.create(model="anthropic/claude-sonnet-5", messages=messages, tools=tools)
print(final.choices[0].message.content)

JavaScript

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://nymbot.ai/api/v1", apiKey: process.env.NYMBOT_API_KEY });

const tools = [{
  type: "function",
  function: {
    name: "get_invoice_status",
    description: "Look up whether an invoice is paid.",
    parameters: {
      type: "object",
      properties: { invoice_id: { type: "string" } },
      required: ["invoice_id"],
    },
  },
}];
const messages = [{ role: "user", content: "Has invoice a41f been paid?" }];

const reply = await client.chat.completions.create({ model: "anthropic/claude-sonnet-5", messages, tools });
const call = reply.choices[0].message.tool_calls[0];
const args = JSON.parse(call.function.arguments);

messages.push(reply.choices[0].message);
messages.push({ role: "tool", tool_call_id: call.id, content: JSON.stringify({ paid: true }) });

const final = await client.chat.completions.create({ model: "anthropic/claude-sonnet-5", messages, tools });
console.log(final.choices[0].message.content);

ציטיילן אין אַ ביקוש

און דוגמאות capabilities.vision אפשר לייענען די צילמעטער. image_url דעריבער, איר קענען באַקומען אַ נייַעס, מיט אַ ציבור. https:// לינק און א data:image/…;base64, דעריבער, איר קענען באַקומען אַ פאַרווודיק אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּערייטינג אַפּער400 invalid_image_urlאון א אופציעל detail און auto, low און high.

און nymbot/auto, אַ פּרייַז מיט אַ בילד אין עס איז ראַוטעד צו אַ סטאַנדאַרד מאָדעל וואָס קענען זען. capabilities.vision באַקומען צילומים מיט 400 unsupported_contentדי לינק וועט זען צו אַ ציבור הוסט; Nymbot passes the picture to the model's provider and doesn't keep it.

אַ בילד איז געשלעכט ווי די ינפאָרדונג טאָקן די פּראָוואַדרער קאָנטיינט פֿאַר עס, ווי די אנדערע פון די באַקומען.

cURL

curl https://nymbot.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $NYMBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-5",
    "messages": [{
      "role": "user",
      "content": [
        {"type": "text", "text": "What is in this picture?"},
        {"type": "image_url", "image_url": {"url": "https://example.com/receipt.jpg"}}
      ]
    }]
  }'

Python

import base64, os
from openai import OpenAI

client = OpenAI(base_url="https://nymbot.ai/api/v1", api_key=os.environ["NYMBOT_API_KEY"])

with open("receipt.jpg", "rb") as f:
    data_url = "data:image/jpeg;base64," + base64.b64encode(f.read()).decode()

reply = client.chat.completions.create(
    model="anthropic/claude-sonnet-5",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "What is in this picture?"},
            {"type": "image_url", "image_url": {"url": data_url}},
        ],
    }],
)
print(reply.choices[0].message.content)

JavaScript

import { readFile } from "node:fs/promises";
import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://nymbot.ai/api/v1", apiKey: process.env.NYMBOT_API_KEY });

const dataUrl = "data:image/jpeg;base64," + (await readFile("receipt.jpg")).toString("base64");

const reply = await client.chat.completions.create({
  model: "anthropic/claude-sonnet-5",
  messages: [{
    role: "user",
    content: [
      { type: "text", text: "What is in this picture?" },
      { type: "image_url", image_url: { url: dataUrl } },
    ],
  }],
});
console.log(reply.choices[0].message.content);

רעיון

און דוגמאות capabilities.reasoning איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב. reasoning_effort ("minimal", "low", "medium" און "high"און "reasoning": {"effort": "high"}און Add :thinking און מיך [חלילה, נישט מיך - איך מיין די רעכטע] אויך נישט! nymbot/auto, :thinking דערגרייכט די רעקאָרדינג רעקאָרדינג.

אויף Anthropic models the effort becomes a thinking budget of about 1,000, 2,000, 8,000 or 16,000 tokens, never more than max_tokens דעריבער, די מחשבות זענען געפירט tool_choice כ'האף די ווען (מיטן דרייווער) זאלן מארך ימים זיין. - און זיי וועלן דרש בּײַ די אֱלִילִים, און בּײַ די אובות [אִטּי], און בּײַ די אטים [אוֹב], און בּײַ די אובות [אוֹב], און בּײַ די ידעונים [יִדּי], און בּײַ די ידעונים [יִדּי], און בּײַ די ידעונים [יִדּי], און בּײַ די ידעונים [יִדּי], און בּײַ די ידעונים [יִדּי], און בּײַ די ידעונים [יִדּי], און בּײַ די ידעונים [יִדּי], און בּײַ די ידעונים [יִדּי].

די רעיון איז חוזר. message.reasoning_contentאון delta.reasoning_content כ'האף די ווען (מיטן דרייווער) זאלן מארך ימים זיין. completion_tokensעטלעכע פאָרויסזאָגן באַקומען אין די רעיון טקסט בכלל, and it is still charged.

cURL

curl https://nymbot.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $NYMBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-5",
    "reasoning_effort": "high",
    "messages": [{"role": "user", "content": "Is 2^61 - 1 prime? Show why."}]
  }'

Python

import os
from openai import OpenAI

client = OpenAI(base_url="https://nymbot.ai/api/v1", api_key=os.environ["NYMBOT_API_KEY"])

reply = client.chat.completions.create(
    model="anthropic/claude-sonnet-5",
    reasoning_effort="high",
    messages=[{"role": "user", "content": "Is 2^61 - 1 prime? Show why."}],
)
message = reply.choices[0].message
print(getattr(message, "reasoning_content", None))
print(message.content)

JavaScript

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://nymbot.ai/api/v1", apiKey: process.env.NYMBOT_API_KEY });

const reply = await client.chat.completions.create({
  model: "anthropic/claude-sonnet-5",
  reasoning_effort: "high",
  messages: [{ role: "user", content: "Is 2^61 - 1 prime? Show why." }],
});
console.log(reply.choices[0].message.reasoning_content);
console.log(reply.choices[0].message.content);

דמיין סאַפיקס

אַ ספיקס אויף די מאָדעל נומער ווי די באַהאַנדלונג פון די באַהאַנדלונג, without another field. They work on full ids and short names alike, as in anthropic/claude-sonnet-5:online.

דיאון אפקט
:onlineדערוואַקסן דעם אינטרנט, ווי plugins: [{"id": "web"}]און WEB דעריבער.
:thinkingעס איז געווען די מעשה; on nymbot/autoאין די מאָל, אין די מאָל אין די מאָל, 400 model_not_found און “ אין אַנדיפּאָניטעס געפֿונען ”.
:nitro, :floor, :exacto, :extendedיעדער קאַטאָלאָד מאָדעל האט אַ רעקאָרע, אַזוי עס איז אין פּרייַז, פּרייַז, אָדער פּרייַז מער צו בחר; די סופשיקס זענען געפֿונען אַזוי מאָדעל נומער קאַפּידעד פון אנדערע טעלעפאָנירן still work.

יעדער אנדערע ספיקס איז געניצט. The whole name is tried first, so a model whose id really contains a colon still works; failing that, suffixes are taken off the end one at a time until a model matches. A model name can be at a maximum 200 characters long with at a maximum 4 suffixes; a longer one is refused with 400 invalid_value.

cURL

curl https://nymbot.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $NYMBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-5:thinking",
    "messages": [{"role": "user", "content": "Plan a three-day trip to Lisbon."}]
  }'

Python

import os
from openai import OpenAI

client = OpenAI(base_url="https://nymbot.ai/api/v1", api_key=os.environ["NYMBOT_API_KEY"])

reply = client.chat.completions.create(
    model="anthropic/claude-sonnet-5:thinking",
    messages=[{"role": "user", "content": "Plan a three-day trip to Lisbon."}],
)
print(reply.choices[0].message.content)

JavaScript

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://nymbot.ai/api/v1", apiKey: process.env.NYMBOT_API_KEY });

const reply = await client.chat.completions.create({
  model: "anthropic/claude-sonnet-5:thinking",
  messages: [{ role: "user", content: "Plan a three-day trip to Lisbon." }],
});
console.log(reply.choices[0].message.content);

Nymbot searches for the last user message (its first 2,000 characters), reads the best pages and gives them to the model with question, marked as external content the model should not take instructions from.

  • תמיד מחפש: "plugins": [{"id": "web", "max_results": 5}]און א :online די סענטימעטער על המודל.
  • דעריבער, when it helps: "tools": [{"type": "web_search", "parameters": {"max_results": 5}}]און איך בין איך web_search_preview און openrouter:web_searchNymbot searches only when the question looks like it needs current information, די ווידעא טסט די אַפּ געניצט.

max_results אין די 5 סענטימעטער און אין די 10 סענטימעטער nymbot.web_search.sourcesיעדער איינער מיט א title, snippet און urlאון איך url_citation אנגעקומען אין די הודעה.

יעדער פאָרשונג אַז ריצן קויסט $0.008, קאַמפּערד צו סאַטס, אויף די טאָקן, און עס איז חלק פון די האַנדל. The pages it reads are input tokens too, so a answer from the web costs more than the same question asked cold, sometimes several times more.

די תשובה איז, חלק

"nymbot": {
  "balance": "pro",
  "charged_credits": 0.431,
  "charged_sats": 43.1,
  "balance_credits": 411.994,
  "balance_sats": 41199.4,
  "web_search": {
    "sources": [
      { "title": "Lightning Network - Wikipedia", "snippet": "The Lightning Network is a payment protocol...", "url": "https://en.wikipedia.org/wiki/Lightning_Network" }
    ]
  }
}

cURL

curl https://nymbot.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $NYMBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-5",
    "plugins": [{"id": "web", "max_results": 5}],
    "messages": [{"role": "user", "content": "What changed in the latest Bitcoin Core release?"}]
  }'

Python

import os
from openai import OpenAI

client = OpenAI(base_url="https://nymbot.ai/api/v1", api_key=os.environ["NYMBOT_API_KEY"])

reply = client.chat.completions.create(
    model="anthropic/claude-sonnet-5",
    messages=[{"role": "user", "content": "What changed in the latest Bitcoin Core release?"}],
    extra_body={"plugins": [{"id": "web", "max_results": 5}]},
)
print(reply.choices[0].message.content)
for source in reply.model_extra["nymbot"]["web_search"]["sources"]:
    print(source["url"])

JavaScript

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://nymbot.ai/api/v1", apiKey: process.env.NYMBOT_API_KEY });

const reply = await client.chat.completions.create({
  model: "anthropic/claude-sonnet-5",
  plugins: [{ id: "web", max_results: 5 }],
  messages: [{ role: "user", content: "What changed in the latest Bitcoin Core release?" }],
});
console.log(reply.choices[0].message.content);
for (const source of reply.nymbot.web_search.sources) console.log(source.url);

ענטפער איך

OpenAI's newer format, used by the OpenAI Agents SDK and by Codex. It runs on the same models, billing and features as Chat Completions.

POST https://nymbot.ai/api/v1/responses יעדער איינער האט א API Key.

פעלדאוןדרושיםתיאור
modelאון Stringיאאיך צאָלן סיוםס'איז א שייכות כולל.
inputאון ער איז array.יאאון זייער מיך [חלילה, איך מיין די רעכטע] אויך נישט! user, assistant, system, developerאון input_text, input_image און output_text און חלקי function_call און function_call_output סענטימעטער פון כלי. input_image און א image_url אַ לינק אָדער דאַטן URL, אין אַ קובץ ID. reasoning און web_search_call די פריע זענען געפונען; item_reference און א סותר.
instructionsאון Stringאיןאון מערכות הוראות.
max_output_tokensאיןאיןמיט די מערסט צו שרייַבן.
temperature
top_p
מספראיןאַוועקלייגן אַוועקלייגן אַוועקלייגן, where the model takes them.
tools
tool_choice
parallel_tool_calls
אַריבער, string אָדער אובייקט, booleanאיןכ'האף די ווען (מיטן דרייווער) זאלן מארך ימים זיין.{"type": "function", "name": …, "parameters": …}און א web_search און web_search_preview טעלעפאָנירן turn on WEB דעריבער איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב איך האָב.
reasoningאון אובייקטאין{"effort": "minimal" | "low" | "medium" | "high"}. xhigh און max און high; none עס איז פעלט.
text.format
response_format
און אובייקטאיןאַוועקלייגן אַוועקלייגן, אַוועקלייגן אַוועקלייגן אַוועקלייגן אַוועקלייגן אַוועקלייגן אַוועקלייגן אַוועקלייגן אַוועקלייגן אַוועקלייגן אַוועקלייגן אַוועקלייגן אַוועקלייגן אַוועקלייגן json_object.
metadataאון אובייקטאיןדערגרייכט אין אַפּענדיקט אין די ענטפער. At a maximum of 16 string values, keys up to 64 characters and values up to 512.
streamבאָליאיןס'איז דא א באקאנטע אויסדרוק being like the events described below.
storeבאָליאיןאין די ענטפער, אין די ענטפער: "store": false.
previous_response_id
conversation
background
אַוועקלייגן, אַוועקלייגן, אַוועקלייגןאיןאין די תומכים: 400 unsupported_parameterדי תשובה זענען לא שטעלן, so send the entire conversation in input כל פעם

תגובה

{
  "id": "resp_8c1e4b0f9a2d4e61",
  "object": "response",
  "created_at": 1790726400,
  "status": "completed",
  "model": "anthropic/claude-sonnet-5",
  "output": [
    {
      "type": "message",
      "id": "msg_2b7f",
      "role": "assistant",
      "status": "completed",
      "content": [{ "type": "output_text", "text": "A Lightning invoice is...", "annotations": [] }]
    }
  ],
  "output_text": "A Lightning invoice is...",
  "usage": {
    "input_tokens": 1240,
    "input_tokens_details": { "cached_tokens": 0 },
    "output_tokens": 380,
    "output_tokens_details": { "reasoning_tokens": 0 },
    "total_tokens": 1620
  },
  "incomplete_details": null,
  "error": null,
  "instructions": null,
  "store": false,
  "previous_response_id": null,
  "metadata": {},
  "nymbot": { "balance": "pro", "charged_credits": 0.162, "charged_sats": 16.2, "balance_credits": 412.425, "balance_sats": 41242.5 }
}

צו דערגרייכן צו דערגרייכן output און א function_call פּרייַז call_id, name און argumentsער איז געווען א תוצאה חזרה function_call_output און א דבר עם אותו call_idאון דעריבער, איך האב נישט, איז א reasoning פּרייַז reasoning_text דעריבער דעריבער דעריבער. status און incomplete כ'האף די תשובה האט max_output_tokens און מיך [חלילה, נישט מיך - איך מיין די רעכטע]. incomplete_details.reason געפירט max_output_tokens און content_filterדי ענטפער איז אויך ענטפער צו די אָפּשאַצונג פון די אָפּשאַצונג (טמפרטאָרמאַטור, Tools, Tool Choice and so on) ווי OpenAI's does, and carries the nymbot עס איז א אובייקט.

דעריבער, כל אירוע איז event: און א data: און מיט א sequence_numberאין דעם סדר: response.created, response.in_progress, response.output_item.added, response.content_part.addedיעדער מספר response.output_text.delta, response.output_text.done, response.content_part.done, response.output_item.doneאון סוף response.completed עס איז געווען א באקאנטע ענטפער: A short end with response.incomplete אין די ענטפער איז עס געגרינדעט מיט response.failedאון איך בין איך בין איך בין איך בין איך response.reasoning_text.delta און .doneאון דעריבער א באקאנטע מינדערוויכטיג, און כל מינדערוויכטיג response.function_call_arguments.delta און .done.

סטאַטןאיך
400אין model און input; previous_response_id, conversation, background און א item_reference (unsupported_parameter); אַ אַפּראָוטעד אין אַפּראָוטעדן טעלעפאָנירן אָדער קאַנטייטינג טיפּ.
402, 403, 404, 429, 502, 503און די צ'אט סיום.

cURL

curl https://nymbot.ai/api/v1/responses \
  -H "Authorization: Bearer $NYMBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-5",
    "instructions": "Answer in one short paragraph.",
    "input": "What is a Lightning invoice?"
  }'

Python

import os
from openai import OpenAI

client = OpenAI(base_url="https://nymbot.ai/api/v1", api_key=os.environ["NYMBOT_API_KEY"])

response = client.responses.create(
    model="anthropic/claude-sonnet-5",
    instructions="Answer in one short paragraph.",
    input="What is a Lightning invoice?",
)
print(response.output_text)

JavaScript

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://nymbot.ai/api/v1", apiKey: process.env.NYMBOT_API_KEY });

const response = await client.responses.create({
  model: "anthropic/claude-sonnet-5",
  instructions: "Answer in one short paragraph.",
  input: "What is a Lightning invoice?",
});
console.log(response.output_text);

אַנטראָפּאָסינג Messages

Anthropic's format, פֿאַר די Anthropic SDKs און Claude Code. It works with every model in the catalog, not only Claude: the request is translated, run through the same pipeline, and translated back.

POST https://nymbot.ai/api/v1/messages זײַנען אַ API key, ווי x-api-key און Authorization: Bearer.

און anthropic-version און anthropic-beta Anthropic model names are matched to the catalog, so Claude Code and the SDKs work with the names they already use:

  • און איך בין איך בין איך בין איך בין איך... claude-sonnet-5 און anthropic/claude-opus-5יעדער איינער כפי שהוא.
  • א באקאנטע אויסדרוק (-20260514), -latestאון די ווערסיע ווי -v1און איך בין איך [1m] און א anthropic/ און anthropic. און מיך [חלילה, נישט מיך - איך מיין די רעכטע] אויך נישט!claude-haiku-4-5 געפירט claude-haiku-4.5).
  • If that still matches nothing, the family (Opus, Sonnet אָדער Haiku) is used, so long as the catalog's version is the same or newer than the one requested for.
  • עס איז געווען אין די שמות 404 not_found_error.
פעלדאוןדרושיםתיאור
modelאון Stringיאאַ קאַטאַל מאָדעל ID, אָדער אַ Anthropic מאָדעל Name.
max_tokensאיןיאמיט די מערסט צו שרייַבן.
messagesאוןיאuser און assistant און נישט, מיט text, image (Base64 אָדער URL source) tool_use און tool_result און בלוק. thinking בלאָקעס פון בעבר טורדים זענען אַקענדיקט און געפירט.
systemאון ער איז array.איןמערסטמאָמאַט, ווי אַ string אָדער טקסט בלאָקים.
temperature
top_p
מספראיןאַוועקלייגן אַוועקלייגן אַוועקלייגן, where the model takes them. top_k געפירט און געפירט.
stop_sequencesאון די Strings.איןטקסט וואָס געגרינדעט די תשובה. אין מאַקסימום 4 שורה, יעדער מאַקסימום 256 דייקס.
tools
tool_choice
ער איז א אובייקטאיןאון א כלי name, description און input_schemaאון א web_search ס'איז נישט ס'איז נישט WEB דעריבער; Anthropic's other built-in tools (באַש, טקסט עדיקטער, קאָמפּיוטער געניצט) זענען געניצט מיט unsupported_tool. tool_choice און auto, any, tool און noneאון disable_parallel_tool_use.
thinkingאון אובייקטאין{"type": "enabled", "budget_tokens": 8192}, {"type": "adaptive"} און {"type": "disabled"}די Budget picks an effort level: אונטער 2,048 מינימום, פון 2,048 נייַ, פון 8,192 בינונימום, פון 16,384 גבוה. output_config.effortאון די גבוה.
streamבאָליאיןדערגרייכט די אַנטראָפּעראַטור פון אַנטראָפּ.
metadataאון אובייקטאיןגעפירט און געפירט.

תגובה

{
  "id": "msg_01c7a2f93e5b4d08",
  "type": "message",
  "role": "assistant",
  "model": "anthropic/claude-sonnet-5",
  "content": [{ "type": "text", "text": "A Lightning invoice is..." }],
  "stop_reason": "end_turn",
  "stop_sequence": null,
  "usage": {
    "input_tokens": 1240,
    "output_tokens": 380,
    "cache_read_input_tokens": 0,
    "cache_creation_input_tokens": 0
  },
  "nymbot": { "balance": "pro", "charged_credits": 0.162, "charged_sats": 16.2, "balance_credits": 412.425, "balance_sats": 41242.5 }
}

content אפשר אויך tool_use בלאָק און א thinking בלאָק איז מי signature און ריק stop_reason און end_turn, max_tokens, tool_use און refusalא באקאנטע אויסדרוק איך finish_reason און צאָלן סיום; stop_sequence און תמיד nullאון איך בין נישט די סיום פון התשובה. input_tokens און מיך [חלילה, נישט מיך - איך מיין די רעכטע] אויך נישט! nymbot א אובייקט און X-Nymbot-Cost-Sats דעריבער

אַוועקלייגן, די אַוועקלייגן זענען Anthropic's: message_start, content_block_start, ping, content_block_delta (text_delta, input_json_delta און thinking_delta), content_block_stop, message_delta און די סיבה, די שימוש און nymbot עס איז א אובייקט, און message_stopאון א ping יעדער 15 סענטימעטער איז געשלעכט מיט די מאָדעל. Tool calls arrive after the text, each as a tool_use עס איז באקומען צו כל אחד באחד input_json_delta.

טעג אויף דעם אַדרפּאָניט צו נוצן Anthropic's format: {"type": "error", "error": {"type": "not_found_error", "message": "…"}}און איז א קיצור איז 402 billing_errorעס איז געווען overloaded provider. 503 overloaded_errorאון דעריבער איז עס געגרינדעט, און איך האב געגרינדעט. error איז א אירוע.

cURL

curl https://nymbot.ai/api/v1/messages \
  -H "x-api-key: $NYMBOT_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5",
    "max_tokens": 1024,
    "messages": [{"role": "user", "content": "What is a Lightning invoice?"}]
  }'

Python

import os
import anthropic

client = anthropic.Anthropic(base_url="https://nymbot.ai/api", api_key=os.environ["NYMBOT_API_KEY"])

message = client.messages.create(
    model="claude-sonnet-5",
    max_tokens=1024,
    messages=[{"role": "user", "content": "What is a Lightning invoice?"}],
)
print(message.content[0].text)

JavaScript

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({ baseURL: "https://nymbot.ai/api", apiKey: process.env.NYMBOT_API_KEY });

const message = await client.messages.create({
  model: "claude-sonnet-5",
  max_tokens: 1024,
  messages: [{ role: "user", content: "What is a Lightning invoice?" }],
});
console.log(message.content[0].text);

דעריבער טוקינס

עס איז א מערכות פון ווי כמה טאָקן אַ Messages request וועט נוצן, so a client can check before it sends. It is free, but still needs a key.

POST https://nymbot.ai/api/v1/messages/count_tokens זײַנען זײַנען זײַנען זײַנען זײַנען זײַנען זײַנען זײַנען.

און די גוף איז אותו דבר הודעותאין max_tokens; די מאָדעל נומער האט צו פאָרויסזאָגן. The count is an estimate: the characters of the system prompt, messages, tool calls and tool definitions divided by four, plus 1,600 for each picture. It is not the provider's own tokenizer, so the real count can differ. A key that has reached its cap can still use it.

תגובה

{ "input_tokens": 318 }

cURL

curl https://nymbot.ai/api/v1/messages/count_tokens \
  -H "x-api-key: $NYMBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-sonnet-5",
    "messages": [{"role": "user", "content": "What is a Lightning invoice?"}]
  }'

Python

import os
import anthropic

client = anthropic.Anthropic(base_url="https://nymbot.ai/api", api_key=os.environ["NYMBOT_API_KEY"])

count = client.messages.count_tokens(
    model="claude-sonnet-5",
    messages=[{"role": "user", "content": "What is a Lightning invoice?"}],
)
print(count.input_tokens)

JavaScript

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({ baseURL: "https://nymbot.ai/api", apiKey: process.env.NYMBOT_API_KEY });

const count = await client.messages.countTokens({
  model: "claude-sonnet-5",
  messages: [{ role: "user", content: "What is a Lightning invoice?" }],
});
console.log(count.input_tokens);

לייענען מאָדעלס

יעדער מאָדעל און גאַנדרער די API אַקענדיקט, מיט וואָס עס קויסט. The list is read from the same live catalog as the app's picker, so it's always what the server will run.

GET https://nymbot.ai/api/v1/models אין טעלעפאָנירן אין 5 מינוט.

GET /api/v1/models/{id} אנגעקומען אין 1 entry.

פעלדאוןדרושיםתיאור
typeדעריבער (Queryאיןchat און זייער זייער מינדערוויכטיג. image, video, audio, embedding און allיעדער איינער יכולתו, ווי image,video.

פּרייַז זענען וואָס איר באַקומען, מיט די פּרייַז and margin already in, in dollars and in sats at the current Bitcoin price. balance דעריבער איז עס באקומען איז א מודל. nymbot_key עס איז די שמו של המודל אין די אַפּ. created עס איז תמיד 0 ווי די קאַטאָלאָם אין רעקאָרדונג ווען אַ מאָדעל איז אַדויד. per_request אַנשטאָט.

nymbot/auto און תמיד קודם, איך בין. variableאון א routes די רשימה צו דערגרייכן יעדער סטאַנדאַרד רעקאָרדס. It lists vision and reasoning, but not tools.

GET /api/v1/models/{id} א באקאנטע שמות און אַדמיניזעס ווי אַ פאָרשונג, and returns the entry for the model they resolve to.

תגובה

{
  "object": "list",
  "data": [
    {
      "id": "anthropic/claude-sonnet-5",
      "object": "model",
      "type": "chat",
      "owned_by": "anthropic",
      "name": "Claude Sonnet 5",
      "created": 0,
      "context_length": 1000000,
      "max_output_tokens": 64000,
      "architecture": { "input_modalities": ["text", "image"], "output_modalities": ["text"] },
      "supported_parameters": ["max_tokens", "temperature", "tools", "tool_choice", "reasoning", "response_format", "stop"],
      "capabilities": { "vision": true, "video": false, "tools": true, "reasoning": true, "web_search": true },
      "balance": "pro",
      "pricing": {
        "type": "per_token",
        "currency": "USD",
        "input_per_1M_tokens": 4.725,
        "output_per_1M_tokens": 23.625,
        "cache_read_per_1M_tokens": 0.4725,
        "sats_input_per_1M_tokens": 4038,
        "sats_output_per_1M_tokens": 20192
      },
      "description": "...",
      "nymbot_key": "claude-sonnet"
    }
  ]
}

די אנדערע מינים:

  • דמיון Entrées און capabilities (accepts_image_url, requires_image_url, editאון די מחיר per_generation.
  • וידאו Entrées און max_duration_seconds און resolutionsאון די מחיר per_second און כל החלטה.
  • און אודיו Entrées און audio_type speech און transcriptionפּרייַז per_1k_chars און per_minute.
  • ביידע Entrées און dimensions, context_length, max_inputs עס איז אַ פּרייַז פּער מיליאָן טוקינס.

פּרייַז סימן "estimated": true עס איז געגרינדעט דורך די אַפּ, און עס איז געגרינדעט אין די אַפּ. type חזרה 400.

cURL

curl "https://nymbot.ai/api/v1/models?type=chat"

Python

import requests

models = requests.get("https://nymbot.ai/api/v1/models", params={"type": "chat"}).json()["data"]
for m in models:
    print(m["id"], m["balance"], m["pricing"].get("input_per_1M_tokens"))

JavaScript

const res = await fetch("https://nymbot.ai/api/v1/models?type=chat");
const { data } = await res.json();
for (const m of data) console.log(m.id, m.balance, m.pricing.input_per_1M_tokens);