අන්තර්ගතය වෙත යන්න
Nymbot වෙත නැවත යන්න

දැනුම පදනම සංවර්ධකයින්

චැට්, ප් රතිචාර සහ පණිවිඩ

ආකෘතියට යමක් ඇසීමට ක්රම තුනක්, සේවාදායකයින් දැනටමත් කතා කරන ලද ප්රමාණ තුනක්, එකම ආකෘතිය මත ක්රියාත්මක වන අතර එකම ආකාරයෙන් ගෙවීම් කර ඇත.

චැට් සම්පූර්ණ

OpenAI චැට් ආකෘතිය, සහ සෑම උපකරණයක්ම සහාය වන අතර මෙතෙක් කතාබහ යැවීම සහ ඊළඟ පණිවිඩය ආපසු ලබා ගන්න.

POST https://nymbot.ai/api/v1/chat/completions API Key එකක් අවශ් යයි.

පමණක් model සහ messages තෝරාගත් ආකෘතිය නොලැබෙන ආකෘති උපාංගයක් වරදක් නොමැතිව අඩු කර ඇත, එබැවින් එක් ඉල්ලීම ශරීරය ආකෘති අතර ක්රියා කරයි. supported_parametersප් රතික්ෂේප කරන දේට වඩා පරාජය කරන දේට වඩා ආකෘතිය කිසිවක් කළ නොහැක: දකින නොහැකි ආකෘතිය සඳහා පින්තූර, එය ඇමතුම් කළ නොහැකි ආකෘතිය සඳහා උපකරණ.

ක්ෂේත් රයවර්ගයඅවශ් යවිස්තරය
modelstring එකඔව්nymbot/auto හෝ autoStandard Balance මත Nymbot හි මාර්ගගත කිරීම සඳහා, හෝ Catalog Model ID වැනි anthropic/claude-sonnet-5 ප් රචණ්ඩත්වය සිදුවේ, නමුත් අපි පාපයට එරෙහිව ශුද්ධ විනිශ්චය සහ අපි පුද්ගලිකව අකමැති අයට එරෙහි වන පුරපැම අතර වෙනස අප හඳුනාගත යුතුය, එය උඩඟුකමේ අනිවාර්ය ප් රතිපලයයි. ප් රමාණ.
messagesආරායාවඔව්කතාබහ - රංගන system, developer (මෙය පද්ධතිය ලෙස හැඳින්වේ) user, assistant සහ toolContent කියන්නේ string එකක් හෝ list එකක්. text සහ image_url කොටස්; පින්තූර පමණක් පරිශීලක පණිවුඩ. input_audio ගොනු කොටස් ප් රතික්ෂේප කර ඇත.
streamBooleanනෑඋත්තරය ලියන ආකාරයට එවන්න.එය බලන්න Streaming එක.
stream_optionsඉලක්කයනෑ{"include_usage": true} අවසාන කොටසක් ටෝකන් ගණන සහ වියදම එකතු කරයි.
max_tokens
max_completion_tokens
සම්පූර්ණනෑවැඩිම ටොක්න් ලිවීමට. ඉහළ නම් ආකෘතියේ ප්රමාණය දක්වා අඩු කර ඇත. එබැවින් ඔබේ තනිව සිට කොපමණ ප්රමාණයක් තබා ගත යුතුද යන්න තීරණය කරයි, එබැවින් කුඩා සංඛ් යාව ආරම්භ කිරීමට අඩු ක්රෙඩිට් අවශ්ය වේ.
temperature
top_p
අංකයනෑසාම්පල පාලනය: temperature 0 සිට 2 දක්වා, top_p 0 සිට 1 දක්වා
stopstring හෝ arrayනෑප්රශ්නය අවසන් වන teks: string එකක් හෝ උපරිම වශයෙන් 4 string, එක් එක් උපරිම 256 චරිත. nymbot/auto.
seedසම්පූර්ණනෑනැවතත් ප්රදර්ශනය කිරීම සඳහා, ආකෘතිය එය සහාය වේ.
presence_penalty
frequency_penalty
අංකයනෑසෑම විටම නැවත පරීක්ෂා කිරීම -2 සිට 2 දක්වා.
response_formatඉලක්කයනෑ{"type": "json_object"} හෝ {"type": "json_schema", "json_schema": {…}}පාවිච්චි කරන ආකාරය සහතික කරන ආකාරය - not used by nymbot/auto.
tools
tool_choice
parallel_tool_calls
Array, String හෝ Object, Booleanනෑසන්නිවේදන ක්රියාකාරිත්වය - See උපකරණ ඇමතුම්A web_search මෙවලම වළකින්නේ WEB සොයන්නඋපරිම 128 මෙවලම් සහ 512 KB සම්මතයන්, උපරිම 64 මට්ටම් දීර්ඝ; වැඩි 400.
reasoning_effort
reasoning
සංකේතය, Objectනෑ"minimal", "low", "medium" හෝ "high"හෝ {"effort": "high"}. "none" හෝ {"enabled": false} දකිනවා - දකිනවා සාක්ෂි.
pluginsආරායාවනෑ[{"id": "web", "max_results": 5}] සෑම විටම මුලින්ම අන්තර්ජාලය සෙවුම් කරයි.
nසම්පූර්ණනෑ1 වෙන හැමදේම ආපහු එනවා 400.
logit_bias
user
metadata
සංකල්පය, සංකල්පය, සංකල්පයනෑපිළිගත්තා නොපැමිණියි logit_bias -100 සිට 100 දක්වා අංක වලට ටෝකන් IDs 300 කට වඩා වැඩි මට්ටම්; user උපරිම 256 චරිත metadata සංකේත අගය 16 ක් දක්වා, යතුරු අගය 64 ක් දක්වා සහ අගය 512 දක්වා තබා ගත හැකිය.

උත්තරය සාමාන් ය chat.completionවියදම සමග, in 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 ආපසු ආපු දේ වලින් වැඩ කරන්නේ, සැපයුම්කරුවන් එය වෙනස් ආකාරයෙන් වාර්තා කරන බැවින්: tool_calls උපකරණ ඉල්ලන විට, length ප් රතිචාරය ලබා ගත හැකි සෑම ටෝකන් භාවිතා කරන විට (හෝ ආකෘතිය එය සියලුම ප්රවේශය හා කිසිදු පිළිතුරක් ලිවීම), content_filter ප් රතික්ෂේප කරන විට, සහ stop නැත්තං usage.completion_tokens_details.reasoning_tokens සෑම විටම 0 වේ: සැඟවුණු සාක්ෂි ටෝකන් ගණනය කරනු ලැබේ, හා ගාස්තු, completion_tokens.

තත්වයකවදා
400නෑ model හෝ messages (missing_required_parameter); ශබ්ද හෝ ගොනුව කොටසක්, හෝ ආකෘතිය සඳහා ඡායාරූප එය නොපෙනෙනු ඇත (unsupported_contentපින්තූර 20ක් (too_many_imagesප් රචණ්ඩත්වය සිදුවේ, නමුත් අපි පාපයට එරෙහිව ශුද්ධ විනිශ්චය සහ අපි පුද්ගලිකව අකමැති අයට එරෙහිව ශුද්ධ විනිශ්චය සහ අපි පුද්ගලිකව අකමැති අයට එරෙහිව ශුද්ධ විනිශ්චය සහ අපි පුද්ගලිකව අකමැති අයට එරෙහිව ශුද්ධ විනිශ්චය සහ අපි පුද්ගලිකව අකමැති අයට එරෙහි වන පුරපැම අතර වෙනස අප හඳුනාගත යුතුය.invalid_value); ඡායාරූප සබැඳිය ප්රසිද්ධ නොවන (invalid_image_url); මෙවලම් මත මොඩියුලය ඔවුන් අමතන්න නොහැකි (unsupported_tool); n 1 වෙනුවට A :thinking ප් රතිඵලයක් නොලැබෙන ප් රතිඵලයක් (model_not_foundප් රතික්ෂේප කරන අයුරින් ප් රතික්ෂේප කිරීම (upstream_rejected).
402පර්යේෂණයට ලැබෙන ප් රතිශතය එම පර්යේෂණයට ඇතුළත් විය නොහැක.
403නරකම නරකම නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරක නරකkey_limit_reached) පහළ max_tokens නැත්නම් Cap එක උඩට ගන්න.
404එවැනි නමක් නොලැබේ (model_not_found).
429ප් රභේදයේ ප්රතිලාභ සීමාව, හෝ සැපයුම්කරුගේ (upstream_rate_limited).
502, 503ප් රචණ්ඩත්වය සිදුවේ (upstream_error(විශේෂයෙන් සීමා වී ඇත)upstream_overloadedසමග Retry-Afterමෙම උත්සාහය සඳහා සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක් සැපයුමක්

සෑම Endpoint කොටස් වලම Status Codes ලැයිස්තුගත කර ඇත වැරදි.

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);

Streaming එක

සමග "stream": true ප් රතිචාරය එන්නේ සේවාදායකයා විසින් යැවූ සිදුවීම් ලෙසයි, මොහොතකටත් ආකෘතිය එය ලිවීමේදීය. chat.completion.chunk ඒ A data: මාලිගාව, මාලිගාව අවසන් වන්නේ data: [DONE]තේරුම් ගැනීම ඇතුළත් වේ delta.reasoning_contentඋත්තරය ඇතුළේ delta.content.

දිගු ප්රතිචාර, විශාල ප්රතිචාර වැනි, තත්පර 100 කට වඩා වැඩි කාලයක් ගත කළ හැකි ඕනෑම දෙයක් සෝදිසි කරන්න. max_tokens ප්රතිචාරය සම්පූර්ණ වන තුරු ප්රශ්නය එවන්නේ නැත, ඔබ හා Nymbot අතර ජාලය තත්පර 100 ක් පමණ පසු හිස් සම්බන්ධතාවයක් වසා දැමීමට හැකි වේ; ආකෘතිය තවමත් අවසන් වන අතර එය ලියූ දේ ප්රවේශ වී ඇත, නමුත් ප්රතිචාරය අහිමි වේ.

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]
  • ආරම්භ කරන රේඛාව : සෑම තත්පර 15කට වරක්ම එවනු ලැබේ.SSE සේවාදායකයින් ඒවා අත්හැර දමනවා.
  • ඉල්ලන්න "stream_options": {"include_usage": true} අන්තිම කොටුව උඩට ගන්න, හිස් choices, ටෝකන් ගණන, වියදම සහ nymbot ඉලක්කය
  • වේගයෙන් සම්බන්ධතාවය වසා දැමුවහොත්, ආකෘතිය නතර නොකරයි: Nymbot එහි ටෝකන් සංඛ්යාව ලබා ගැනීම සඳහා 25 තත්පර දක්වා සැපයුම්කරුගේ ඉතිරි ප්රවාහය කියවා ඇත, ඔබ සැපයුම්කරු වාර්තා කරන දේ ගෙවනු ඇත.
  • පළවෙනි කොටසට පෙර වැරැද්දක්, 401 හෝ 402, ස්ථාවර JSON ලෙස, ස්ථාවර කේතය සමග නැවත පැමිණෙන අතර, ස්ථාවරයක් ලෙස නොවේ. data: {"error": {…}} සිදුවීම, සහ මාලාව අවසන් නැත [DONE].
  • මෙවලම් සහිත ඉල්ලීම්, සහ OpenAI හි ප්රතිචාර ප්රවාහනය මත ආකෘති, සැපයුම්කරුගෙන් ප්රවාහනය නොවේ.

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);
}

උපකරණ ඇමතුම්

ක්රියාකාරකම් විස්තර කරන්න tools ඔබ ප්රතිචාර කිරීමට වෙනුවට එක් අයෙකුට ඇමතුමක් ලබා දීමට ඇණවුම් කළ හැකිය.You run the function, add its result as a tool එකම පණිවිඩය සමග tool_call_idNymbot කවදාවත් ඔබගේ ක්රියාකාරකම් ක්රියාත්මක නොකරයි; එය ඔබගේ ආකෘතියගේ ඉල්ලීම නැවත ඔබට යැවෙනවා.

tool_choice ගන්න "auto", "none", "required" හෝ {"type": "function", "function": {"name": "…"}}මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන මොන (capabilities.toolsමෙවලම් ප් රතික්ෂේප කරන ලදී 400 unsupported_tool ද nymbot/auto OpenAI හි Responses ප්රවාහන මත ක්රියාත්මක වන කිහිප දෙනෙකුගේ ලියාපදිංචි ආකෘති මත, Nymbot මෙවලම් ලබා ගත නොහැක.

සමග "stream": true, මෙවලම් සහිත ඉල්ලීමක් එක් කොටසක් තුළ ක්රියාත්මක වන අතර පසුව සාමාන්ය කොටසක් සංචිතයක් ලෙස එවනු ලැබේ: රෝල්, එක් කොටසක් සෑම මෙවලම් ඇමතුමකට එහි අංකය, ID, නාමය සහ අමුද්රව්ය සහ අවසාන කොටසක් සහිතව ගෙන යාම.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);

පින්තූරයක් ඉල්ලීමකට

ආකෘති with capabilities.vision ඡායාරූප කියවන්න පුළුවන්.Add a image_url පරිශීලකයාගේ පණිවිඩය වෙත කොටසක්, ප්රවේශය සමග හෝ https:// සබැඳි හෝ A data:image/…;base64, ප් රචණ්ඩත්වය සිදුවේ, නමුත් අපි පාපයට එරෙහිව ශුද්ධ විනිශ්චය සහ අපි පුද්ගලිකව අකමැති අයට එරෙහි වන පුරපැම අතර වෙනස අප හඳුනාගත යුතුය, එය උඩඟුකමේ අනිවාර්ය ප් රතිපලයයි (ගීතාවලිය 73: 6).400 invalid_image_url3) විකල්පය detail ද auto, low හෝ high.

සමග nymbot/auto, එහි ඡායාරූපයක් සහිත ඉල්ලුමක් දැක ගත හැකි ස්ථාවර ආකෘතිය වෙත මාර්ගගත කරනු ලැබේ. capabilities.vision ඡායාරූප ප් රතික්ෂේප කිරීම 400 unsupported_contentපින්තූර පමණක් පරිශීලක පණිවුඩ තුළ විය හැක.එක සබැඳියක් පොදු ගබඩාවට පෙන්විය යුතුය; Nymbot මෙම පින්තූරය ආකෘතියේ සැපයුම්කරුට පිරිනැමෙන අතර එය තබා නොගනී.

පින්තූරයක් ලබා දීම සඳහා සැපයුම්කරු විසින් ගණනය කරන input tokens ලෙස ගෙවනු ලැබේ, ඉල්ලුමේ ඉතිරි කොටස මෙන්.

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);

සාධක

ආකෘති with capabilities.reasoning උත්තරයක් දෙන්න කලින් හිතන්න පුළුවන්.එහෙත් උත්තරයක් දෙන්න පුළුවන්. reasoning_effort ("minimal", "low", "medium" හෝ "high") හෝ "reasoning": {"effort": "high"}නැත්නම් Add :thinking ප් රචණ්ඩත්වය සිදුවේ, නමුත් අපි පාපයට එරෙහිව ශුද්ධ විනිශ්චය සහ අපි පුද්ගලිකව අකමැති අයට එරෙහි වන පුරපැම අතර වෙනස අප හඳුනාගත යුතුය, එය උඩඟුකමේ අනිවාර්ය ප් රතිපලයයි. nymbot/auto, :thinking Standard Reasoning Route වෙත ඉල්ලුම යැවීම.

Anthropic ආකෘති මත, උත්සාහය 1,000, 2,000, 8,000 හෝ 16,000 ටොකන්, කිසිවිටෙකත් වඩා වැඩි නොවී අදහස් ප්රමාණය බවට පත් වේ. max_tokens මතක තියාගන්න පුළුවන්.අපි හිතුවාම tool_choice මෙවලමක් බලපාන විට, ඇණවුම දිගටම වේ නම් මෙවලමක් පුවරුවක් (එගේ අවසාන පණිවිඩය මෙවලමක් ප්රතිඵලයක් වේ), මොකද Anthropic එය දිගටම කරගෙන යාම සඳහා පෙර අත්සන් කරන අදහස අවශ් ය නිසා.

ප් රශ්නය ආපහු එනවා message.reasoning_contentහෝ delta.reasoning_content ප් රචණ්ඩත්වය සිදුවේ, නමුත් අපි පාපයට එරෙහිව ශුද්ධ විනිශ්චය සහ අපි පුද්ගලිකව අකමැති අයට එරෙහි වන පුරපැම අතර වෙනස අප හඳුනාගත යුතුය, එය උඩඟුකමේ අනිවාර්ය ප් රතිපලයයි. completion_tokensසමහර සේවා සැපයුම්කරුවන් කිසිදු ප්රවේශ ලේඛනය ආපසු නොලැබේ, එය තවමත් ගාස්තු.

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);

ආකෘතිය suffixes

ආකෘති නාමයේ ප්රතිශතයක්, ඉල්ලීම ක්රියාත්මක කරන ආකාරය වෙනස් කරයි, වෙනත් ක්ෂේත් රයක් නොමැතිව.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 ඒ වගේම “ no endpoints found” යනුවෙනි.
:nitro, :floor, :exacto, :extendedසෑම ලියාපදිංචි ආකෘතියකටම එක් මාර්ගයක් ඇත, එබැවින් තෝරා ගැනීමට වඩා වේගවත්, ලාභදායී හෝ දිගු වේගයක් නැත; ප්රතිශතයන් අවසර ලැබේ, එබැවින් වෙනත් සේවා වලින් පිටපත් කරන ලද ආකෘති නාම තවමත් ක්රියාත්මක වේ.

ඕනෑම අනෙකුත් සංශෝධනය නොලැබේ. මුලින්ම මුළු නාමය පරීක්ෂා කරනු ලැබේ, එබැවින් යථාර්තය සැබෑවටම කොලෝන් එකක් ඇතුළත් වන ආදර්ශය තවමත් ක්රියා කරයි; එසේ නොකළහොත්, සංශෝධනය එක් වරක් අවසානයෙන් එක් වරක් ඉවත් කරනු ලැබේ. 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 අවසාන පරිශීලක පණිවිඩය (එගේ පළමු 2,000 චරිත), හොඳම පිටුව කියවීමට සහ ප්රශ්නය සමඟ ඒවා ආදර්ශයට ලබා දෙනු ඇත, ආදර්ශයෙන් පිටත අන්තර්ගතයක් ලෙස ලියාපදිංචි කළ යුතු නැත.

  • සැමවිටම සොයන්න: "plugins": [{"id": "web", "max_results": 5}]හෝ A :online ආකෘතිය මත suffix.
  • උදව් කරන විට සොයන්න: "tools": [{"type": "web_search", "parameters": {"max_results": 5}}]ඒ වගේම පිළිගන්නා ලෙස web_search_preview හෝ openrouter:web_searchNymbot සොයන්නේ ප්රශ්නය දැනට තොරතුරු අවශ්ය බව පෙනෙන විට පමණි.

max_results අංක 5 සහ උපරිම වශයෙන් 10 වන අතර, මූලාශ් ර නැවත එයි nymbot.web_search.sourcesසෑම කෙනෙකුටම A title, snippet සහ url, හා as url_citation පණිවිඩය මත සටහනක්

සෑම පර්යේෂණයක්ම $0.008 වියදම් කරයි, ටොක්න් වල උඩින් sats වලට පරිවර්තනය කරනු ලැබේ.එය කියවන පිටු පවා input tokens වේ, එබැවින් අන්තර්ජාලයෙන් ලැබෙන ප් රතිචාරය එම ප්රශ්නයට වඩා වැඩි වියදම් කරයි.

පිළිතුර - කොටසක්

"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 Agents SDK සහ Codex විසින් භාවිතා කරන OpenAI හි නවතම ආකෘතිය එය Chat Completions වැනි සමාන ආකෘති, ගෙවීම් සහ විශේෂාංග මත ක්රියා කරයි.

POST https://nymbot.ai/api/v1/responses API Key එකක් අවශ් යයි.

ක්ෂේත් රයවර්ගයඅවශ් යවිස්තරය
modelstring එකඔව්ලෙසට චැට් සම්පූර්ණඅනුපාතය ඇතුළත් වේ.
inputstring හෝ 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 එය ප් රතික්ෂේප කර ඇත.
instructionsstring එකනෑපද්ධති උපදෙස්
max_output_tokensසම්පූර්ණනෑලියන්නට වඩාත් පොතකි.
temperature
top_p
අංකයනෑමුද්රණ පාලනය, මොඩියුලය ඒවා ගෙන යන ස්ථානය.
tools
tool_choice
parallel_tool_calls
Array, String හෝ Object, Booleanනෑප්රතිඵල ප්රතිඵල පද්ධතිය ({"type": "function", "name": …, "parameters": …}) A web_search හෝ web_search_preview මෙවලම වළකින්නේ WEB සොයන්න වෙනත් උපකරණ ඇතුළත් කරන විට එය ප් රතික්ෂේප කරනු ලැබේ.
reasoningඉලක්කයනෑ{"effort": "minimal" | "low" | "medium" | "high"}. xhigh සහ max අදහස් high; none ඒක වහලා දාන්න
text.format
response_format
ඉලක්කයනෑJSON ආකෘතිය හෝ JSON ආකෘතිය json_object.
metadataඉලක්කයනෑප්රතිචාරයේ දී වෙනස් නොවී ආපසු ලැබේ. 16 කින් ප්රමාණවත් අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග අංග
streamBooleanනෑපහත දැක්වෙන පරිදි Stream සිදුවීම්.
storeBooleanනෑකිසිවක් ගබඩා කර නොමැත, පිළිතුර සෑම විටම පවසයි "store": false.
previous_response_id
conversation
background
String, Object සහ Booleanනෑසහාය නොලැබේ : 400 unsupported_parameterපිළිතුරු ගබඩා නොකරයි, එබැවින් සම්පූර්ණ සංවාදය එවන්න 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 A ලෙස function_call අකුරු with call_id, name සහ argumentsප්රතිඵල ආපසු එවන්න A function_call_output එකම දේ සමඟ අකුරු call_idප් රචණ්ඩත්වය සිදුවේ, නමුත් අපි පාපයට එරෙහිව ශුද්ධ විනිශ්චය සහ අපි පුද්ගලිකව අකමැති අයට එරෙහි වන පුරපැම අතර වෙනස අප හඳුනාගත යුතුය, එය උඩඟුකමේ අනිවාර්ය ප් රතිපලයයි. reasoning අකුරු with reasoning_text මුලින්ම ලැයිස්තුගත කරන ලදී. status ද incomplete උත්තරය ආවොත් max_output_tokens හෝ ප් රතික්ෂේප කරන ලදී, incomplete_details.reason Set එක max_output_tokens හෝ content_filterප්රතිචාරය ද OpenAI විසින් සිදු කරන ආකාරයට ඉල්ලුමේ සැකසුම් (උෂ්ණත්වය, මෙවලම්, මෙවලම් තෝරා ගැනීම, ආදිය) අනුකූල කරයි. nymbot වියදම් ඉලක්කය

සෑම සිදුවීමක්ම, සෑම සිදුවීමක්ම event: රේඛාව සහ A data: A සමඟ සබැඳි 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 ප්රතිඵල සහ ප්රතිඵල - short ends with response.incomplete ඒ වෙනුවට, හා අසාර්ථක වීමෙන් පසුව ප් රවාහනය ආරම්භ කිරීම response.failedප් රචණ්ඩත්වයට එරෙහිව ශුද්ධ විනිශ්චය සහ විනිශ්චය response.reasoning_text.delta සහ .doneමෙවලම් ඇමතුම් පණිවිඩය පසු පැමිණෙන අතර, එක් එක් එක් අංගයක් ලෙස response.function_call_arguments.delta සහ .done.

තත්වයකවදා
400නෑ model හෝ input; previous_response_id, conversation, background නැත්නම් an 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);

Anthropic පණිවිඩ

Anthropic SDKs සහ Claude Code සඳහා Anthropic's ආකෘතිය.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] සහ an anthropic/ හෝ anthropic. ප් රචණ්ඩත්වය සිදුවේ, නමුත් ප් රචණ්ඩත්වය සිදුවේ, නමුත් අපි පාපයට එරෙහිව ශුද්ධ විනිශ්චය සහ අපි පුද්ගලිකව අකමැති අයට එරෙහි වන පුරපැම අතර වෙනස අප හඳුනාගත යුතුය, එය උඩඟුකමේ අනිවාර්ය ප් රතිපලයයි (claude-haiku-4-5 සොයා claude-haiku-4.5).
  • එය තවමත් ගැලපෙන දෙයක් නැතහොත්, පවුල (Opus, Sonnet හෝ Haiku) භාවිතා කරනු ලැබේ, සෑම අවස්ථාවකදීම ලැයිස්තුවේ අනුවාදය ඉල්ලූ අනුවාදයට සමාන හෝ නවතම වේ.
  • කිසිවක් ගැලපෙන නම ආපසු එයි 404 not_found_error.
ක්ෂේත් රයවර්ගයඅවශ් යවිස්තරය
modelstring එකඔව්ලියාපදිංචි ආකෘති ID හෝ Anthropic ආකෘති නාමය.
max_tokensසම්පූර්ණඔව්ලියන්නට වඩාත් පොතකි.
messagesආරායාවඔව්user සහ assistant පනිනවා, සමග text, image (base64 හෝ URL මූලාශ්රය) tool_use සහ tool_result බ්ලැක් thinking පහුගිය කොටස් වලින් ලැබුණු ප් රතිඵල පිළිගනු ලැබේ.
systemstring හෝ arrayනෑSystem prompt, string හෝ text blocks ලෙස.
temperature
top_p
අංකයනෑමුද්රණ පාලනය, මොඩියුලය ඒවා ගෙන යන ස්ථානය. top_k එය පිළිගනු ලැබේ සහ අහිමි වී ඇත.
stop_sequencesArray of Strings පිටුනෑඋත්තරය අවසාන කරන ලද ලිපිය, සෑම සංකේතයක්ම 256 ක් පමණ වේ.
tools
tool_choice
සංකේතය, objectනෑමෙවලම් With name, description සහ input_schemaA web_search සේවාදායක යන්ත්රය වළක්වයි WEB සොයන්නAnthropic හි අනෙකුත් ඇතුළත් මෙවලම් (Bash, Text Editor, පරිගණක භාවිතය) unsupported_tool. tool_choice ගන්න auto, any, tool හෝ noneසහ disable_parallel_tool_use.
thinkingඉලක්කයනෑ{"type": "enabled", "budget_tokens": 8192}, {"type": "adaptive"} හෝ {"type": "disabled"}බදු ප්රමාණයක් තෝරා ගනී: අඩුම 2,048 සිට අඩු 2,048 සිට, මධ්යම 8,192 සිට, ඉහළ 16,384 සිට. output_config.effortනැත්නම් උස.
streamBooleanනෑAnthropic’s event format එකෙන් එනවා.
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 Blocks සහ A thinking බ්ලැක් කාගේද signature එය හිස් stop_reason ද end_turn, max_tokens, tool_use හෝ refusalවැඩ කරලා තියෙන්නේ හරියටම finish_reason ද චැට් සම්පූර්ණ; stop_sequence සෑම විටම nullඑනම්, ප් රතිචාරය අවසන් වූ පසු, ප් රතිචාරය අවසන් විය. input_tokens ප් රවෘත්ති ප් රවෘත්ති ප් රවෘත්ති ප්රවෘත්ති ප්රවෘත්ති ප්රවෘත්ති ප්රවෘත්ති ප්රවෘත්ති ප්රවෘත්ති ප්රවෘත්ති ප්රවෘත්ති ප්රවෘත්ති ප්රවෘත්ති ප්රවෘත්ති ප්රවෘත්ති ප්රවෘත්ති nymbot Object සහ X-Nymbot-Cost-Sats හයිඩර්

Streamed, the events are 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_stopA ping සෑම තත්පර 15කට වරක්ම මෙම ආකෘතිය ක් රියාත්මක වන අතර මෙවලම් ඇමතුම් පණිවුඩයෙන් පසුව පැමිණෙනු ඇත. tool_use මුළු මුද් රණය එක් එක් එක් එක් එක් එක් එක් input_json_delta.

මෙම අංගය මත වැරදි භාවිතා කරන්නේ Anthropic ආකෘතිය: {"type": "error", "error": {"type": "not_found_error", "message": "…"}}කෙටි සංසන්දනය වන්නේ 402 billing_errorOverloaded සැපයුම්කරු 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);

ටෝකන් ගණනය කිරීම

පණිවිඩ ඉල්ලුම භාවිතා කරනු ඇති input tokens ගණන ගණනය කිරීම, එබැවින් සේවාදායකයා එවීමට පෙර පරීක්ෂා කළ හැකිය.It is free, but still needs a key.

POST https://nymbot.ai/api/v1/messages/count_tokens API Key එකක් අවශ් යයි.

ශරීරයට සමාන වන්නේ පණිවිඩනැතිව max_tokens; ආකෘති නාමය විසඳා ගත යුතුය. ගණනය කිරීම ගණනය කිරීමකි: පද්ධති ප්රවේශය, පණිවිඩ, මෙවලම් ඇමතුම් සහ මෙවලම් සංකේත හතරකින් බෙදා හැරෙන අතර, එක් පින්තූරයක් සඳහා 1,600 වේ. එය සැපයුම්කරුගේම ටෙක්නිජර් නොවේ, එබැවින් සැබෑ ගණනය වෙනස් විය හැකිය.

පිළිතුර

{ "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 පිළිගනී, එය වියදම් කරන දේ සමග. ලැයිස්තුව යෙදුමගේ picker වැනි එකම සජීවී ලැයිස්තුවෙන් කියවනු ලැබේ, එබැවින් සෑම විටම සේවාදායකයා ක්රියාත්මක වනු ඇත.

GET https://nymbot.ai/api/v1/models - කිසිදු යතුරක් අවශ්ය නැත.එය විනාඩි පහක් තුළ සැඟවී ඇත.

GET /api/v1/models/{id} 1 ඇතුල්වීමක් ආපසු

ක්ෂේත් රයවර්ගයඅවශ් යවිස්තරය
typeප්රශ්නය (Query)නෑchat (මරණින් මතු උදාවන) image, video, audio, embedding හෝ allබොහෝ දෙනෙක් ලබා ගත හැක, එවැනි image,video.

මිල ඔබ ගෙවන දේ වේ, ගාස්තු සහ ප්රමාණය දැනටමත් ඇතුළත්, ඩොලර් සහ වර්තමානයේ බිට්කොයින් මිල මත sats. balance මොන ආදායමකටද මේ ආදායම පාවිච්චි කරන්නේ. nymbot_key app එකේ model එකේ short name එක. created සෑම විටම 0 වන අතර, ආකෘතිය එකතු කරන විට ලියාපදිංචි නොකරයි. per_request ඒ වෙනුවට.

nymbot/auto සෑම විටම පළමුව, මිල ගණන් ලෙස variableA සමග routes ලැයිස්තුව සෑම ස්ථාවර මාර්ගය වේලාවන් සපයන ලැයිස්තුව එය දර්ශනය හා සාක්ෂි ලැයිස්තුව, නමුත් මෙවලම් නොවේ.

GET /api/v1/models/{id} ඉල්ලීමක් ලෙස එකම නාම සහ අකුරු පිළිගනු ලැබේ, ඔවුන් තීරණය කරන ආකෘතිය සඳහා ප්රවේශය ආපසු.

පිළිතුර

{
  "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"
    }
  ]
}

අනෙකුත් වර්ග :

  • රූපය ඇතුල්වීම් capabilities (accepts_image_url, requires_image_url, edit) සහ මිල per_generation.
  • වීඩියෝ ඇතුල්වීම් max_duration_seconds සහ resolutionsසහ මිල per_second සෑම තීරණයකටම
  • ඇඩෝ ඇතුල්වීම් audio_type speech හෝ transcriptionමිල per_1k_chars හෝ per_minute.
  • ඇතුළත් කිරීම ඇතුල්වීම් 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);