Tushen ilimi Wasanni
Chat, Yanzu da Messages
Three ways to ask a model something, a cikin uku format da abokan ciniki ya ce, duk da ke aiki a kan samfurori da aka sayar da sama.
An fassara wannan shafin na inji don dacewa. Asalin Ingilishi shine sigar da ke aiki.
Tsarin Chat
The OpenAI chat format, kuma daya da fiye da kowane kayan aiki goyon bayan shi. Send the conversation so far da kuma samun gaba da sabuntawa.
POST https://nymbot.ai/api/v1/chat/completions - Yana bukatar wani API key.
hanya model kuma messages A sampling parameters da aka zabi model ba za a rage ba tare da wani gabatarwa, don haka daya request body aiki tsakanin models. The model list ya ba da kowane model supported_parametersYawan da aka ba da yaushe fiye da yaushe ne abin da model ba za a iya yi: hotuna ga wani model wanda ba za a iya ganin, kayan aiki ga wani model wanda ba za a iya kira su.
| Wasanni | Ƙananan | Tuntube | Tuntube mu |
|---|---|---|---|
model | Tuntube mu | Ee | nymbot/auto (Yaya auto) ga Nymbot ta hanyar a kan al'ada, ko wani catalog model id kamar yadda anthropic/claude-sonnet-5 a kan Pro Balance. Aikace-aikace na shortnames da aliases suna dace. Za a iya Ƙara. |
messages | Kasa | Ee | Ƙaddamarwa. Ƙaddamarwa system, developer (kiya a matsayin tsarin), user, assistant kuma toolContent ne string ko list na text kuma image_url Parts; images kawai a cikin masu amfani messages. input_audio kuma fayiloli sassa ne refused. |
stream | Wasanni | ko | Sauke shawara kamar yadda ya rubuta. Duba Tuntube mu. |
stream_options | Tuntube mu | ko | {"include_usage": true} ya ƙirƙirar wani karshe tare da token sayarwa da kuma kudin. |
max_tokensmax_completion_tokens | Tuntube | ko | Manyan tokens don rubuta. Yadda ya ƙunshi zuwa mafi girma na model idan mafi girma. Har ila yau, ya ƙirƙirƙirar da yawa da aka gane daga balans, don haka wani ƙarin yawan da ake bukata fiye da credit don fara. |
temperaturetop_p | Sabuwar | ko | Sampling tsarin: temperature daga 0 zuwa 2, top_p daga 0 zuwa 1. |
stop | string ko array | ko | Tsarin da ke sa: string ko fiye da 4 string, kowane ne fiye da 256 characters. nymbot/auto. |
seed | Tuntube | ko | Domin daidaitacce sampling, inda model yana taimaka shi. |
presence_penaltyfrequency_penalty | Sabuwar | ko | Ƙirƙirar Ƙirƙirar, kowane daga -2 zuwa 2. |
response_format | Tuntube mu | ko | {"type": "json_object"} ko {"type": "json_schema", "json_schema": {…}}, inda model yana goyon bayan shi. Ba amfani da nymbot/auto. |
toolstool_choiceparallel_tool_calls | array, string ko object, boolean | ko | Shafin shafi: See Tuntubewaa web_search Tool Turns a kan Wasanni. A karkashin 128 kayan aiki da 512 KB na takardun shaida, gyara a karkashin 64 matakin karkashin; more ne a 400. |
reasoning_effortreasoning | Ƙara, Object | ko | "minimal", "low", "medium" ko "high"ko {"effort": "high"}. "none" ko {"enabled": false} Yadda za a yi. See Tuntube mu. |
plugins | Kasa | ko | [{"id": "web", "max_results": 5}] always searches the web first. Har zuwa 10 results. |
n | Tuntube | ko | 1. Duk wani abu ya zo 400. |
logit_biasusermetadata | Object, String, Littafi Mai Tsarki | ko | Takaddun shaida da kuma ba ya saita. logit_bias maps a kan 300 token ids zuwa yawanci daga -100 zuwa 100; user yana da ƙarfi na 256 characters; metadata yana da fiye da 16 string values, keys fiye da 64 characters da kuma values fiye da 512. |
Yanzu ne mai ban mamaki chat.completion, tare da farashin a usage.cost
(a cikin dollar) da kuma a cikin nymbot Ƙididdiga model The model is the resolved model id, don haka wani short name ya zo a matsayin full one. Idan model ya rage kafin ce, ya rage a cikin message.reasoning_contentƘara daga Ƙararrawa
Yanzu
{
"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 da aka gyara daga abin da aka gabatar da, kamar yadda masana'antu sanar da shi daban-daban: tool_calls lokacin da model ya ba da kayan aiki, length a lokacin da matsaloli ya amfani da kowane token karkashin (ko model ya kullum su ra'ayi da kuma ba ya rubuta wani matsaloli), content_filter a lokacin da abokan ciniki ya ba da, da stop
ko da. usage.completion_tokens_details.reasoning_tokens is always 0: hidden reasoning tokens suna sayarwa, kuma karfe, a cikin completion_tokens.
| takardar kebantawa | Kada |
|---|---|
400 | ko model ko messages (missing_required_parameter); audio ko file sassa, ko images ga model cewa ba za a iya ganin su (unsupported_content); fiye da 20 hotuna (too_many_images); samfurin samfurin parameter na alama ko daga yanki (invalid_value); hotuna na hotuna wanda ba ne jama'a (invalid_image_url); kayan aiki a kan wani model cewa ba za a iya kira su (unsupported_tool); n fiye da 1; a :thinking sufi a kan wani model wanda ba za a ra'ayin (model_not_found); ko abokan ciniki ya ba da bukatun (upstream_rejected). |
402 | The balance da model gaskiya ba za a iya haɓaka kudin. |
403 | Mafi matsala ba za a yi amfani da key's cap (key_limit_reached(Ayyuka) max_tokens ko ƙirƙirar cap. |
404 | No model da wannan sunan (model_not_found). |
429 | takardar kebantawa na key, ko na samarwa (upstream_rate_limited). |
502, 503 | Ma'aikatar da aka ba da (upstream_error) ko yaushe (upstream_overloadedƘaddamar Retry-After). Duk da haka, ba za a bayar da ba a kowace abokan ciniki. |
status codes kowane endpoint shigo suna listed a karkashin Tuntube mu.
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);
Wasanni
Ƙaddamar "stream": true Yanzu ya zo a matsayin matsaloli na server yayin da model ya rubuta shi. Kowane matsaloli ne wani matsaloli chat.completion.chunk a data: line, da tsari ya fara tare da data: [DONE]Ƙararrawa ya zo a cikin
delta.reasoning_contentYanzu a cikin delta.content.
Stream wani abu da za a iya dace fiye da kusa da 100 seconds, kamar yadda wani tsawon bayani, wani babban
max_tokens ko wani ra'ayoyi model. A tambayoyi da ba ya sauke ba zai ba su sauke abin da ya fi dace, kuma cibiyar tsakanin ka da Nymbot za a iya shigar wani haƙĩƙa hadin gwiwa bayan game da 100 seconds; da model yana da yaushe da kuma abin da ya rubuta ne da aka sauke, amma shawarar da aka sauke. A stream ya sauke keep-alives, don haka yana da aka haifar da lokacin da model ya sauke.
Ƙananan
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]
- Lines fara da
:SSE na'ura mai aiki da karfin ruwa mai aiki da karfin ruwa mai aiki da karfin ruwa mai aiki da karfin ruwa mai aiki da karfin ruwa mai aiki da karfin ruwa - Yadda za
"stream_options": {"include_usage": true}to get the last chunk above, tare da wani mchoices, da token sayar, da farashin da kumanymbotƘididdiga - Yadda ka shigar sadarwa a karshe, model ba zauna: Nymbot ya karanta rest na samarwa ta hanyar, zuwa 25 seconds, don samun daukewa na token, kuma za ka bayar da abin da samarwa ya gabatar da. Babu da wannan sayarwa, daukewa da aka sayarwa daga sa'o'i da abin da aka rubuta, har da cikakken sa'o'i don samfurin da haka.
- Yanzu kafin farko, kamar yadda
401ko402, ya fara a matsayin m JSON tare da status code, ba tare da alama. A gabatarwa bayan alama ya fara ya zo a matsayin karshedata: {"error": {…}}Event, kuma stream ya fara ba[DONE]. - Ma'aikata tare da kayan aiki, da kuma samfurori a kan OpenAI's Responses kayan aiki, ba zauna daga samarwa. Duk da haka, su zo tare da wani daidaitacce, saita a lokacin da yanayin da aka kammala.
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);
}
Takardar kebantawa
Shafin shafi: Functions in tools kuma model za a iya ba da wani za a ba da kira a gudu. Za ka yi aiki, sa da matsaloli a matsayin tool Tuntubewa tare da wannan
tool_call_idNymbot ba zai yi aiki tare da ayyukanku; shi zai gabatar da baƙi na model zuwa ku.
tool_choice Ƙara "auto", "none",
"required" ko {"type": "function", "function": {"name": "…"}}Model list maras cewa models za a iya kira kayan aiki (capabilities.tools) Instruments suna ba tare da 400 unsupported_tool ya nymbot/auto kuma a kan wasu catalog models da ke aiki a kan OpenAI's Responses transport, wanda Nymbot ba zai iya ba da kayan aiki ga.
Ƙaddamar "stream": true, wani baƙin tare da kayan aiki yana aiki a cikin wani kudi da kuma an saita kamar yadda a normal chunk sequence: da ruwan, wani chunk tare da kowane kayan aiki baƙi tare da index, id, sunan da arguments, da kuma finish chunk. Clients wanda ya karanta Streamed kayan aiki baƙi shi kamar yadda zauna.
Yanar Gizo
"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);
Hotuna a cikin baƙi
Models da capabilities.vision za a iya karanta hotuna. Add a image_url
share zuwa mai amfani bayanin, tare da ko da wani jama'a https:// Link ko a
data:image/…;base64, URL. Up to 20 images per request. SVG images suna rike, da kuma wannan ne a kan wani rubutu fiye da 4,096 characters ko daya tare da user name ko password a cikin shi (400 invalid_image_urla. Ayyuka detail Ya
auto, low ko high.
Ƙaddamar nymbot/auto, wani baƙin tare da hotuna a cikin shi ne ta hanyar zuwa wani standard model da za a iya ganin. A catalog model ba tare da capabilities.vision Ƙirƙirar hotuna tare da
400 unsupported_content. Pictures za a iya zama kawai a cikin masu amfani messaging. A link za a magana zuwa wani jama'a hosting; Nymbot ya ba da hotuna da hotuna don samar da model kuma ba ya sa shi.
A hotuna da aka kira a matsayin input tokens na samar da shi, kamar yadda sauran bukatun.
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);
Tuntube mu
Models da capabilities.reasoning Yadda za a iya yiwuwa kafin su yiwuwa. Yadda za a yiwuwa da mafi ko mafi reasoning_effort ("minimal", "low",
"medium" ko "high"a. "reasoning": {"effort": "high"}, ko Add :thinking to model name, wanda ya ce high effort. A kan wani model ba tare da ra'ayoyi, setup ne ba tare. tare da nymbot/auto, :thinking ya sa shawarar da shawarar zuwa Standard reasoning route.
A kan anthropic samfurori, sha'awar ya zama wani zane-zane na kusa da 1,000, 2,000, 8,000 ko 16,000 tokens, ba zai zama fiye da max_tokens Yadda za a yiwuwa? Yadda za a yiwuwa
tool_choice Shawarar wani kayan aiki, kuma a lõkacin da baƙi yana da wani kayan aiki (ya'akari na farko ne wani kayan aiki), saboda Anthropic yana da bukatun da aka haifar da yaushe shi. Sama shi ne a kan haɗin yanar gizo da Messages.
Ra'ayoyi ya zo a cikin message.reasoning_contentko
delta.reasoning_content a lokacin streaming, ba tare da shawara a cikin bayani. Reasoning ne output da aka kira a matsayin wannan, a cikin completion_tokensDuk da wasu masana'antu ba su ƙirƙirar ra'ayin a kowace, kuma shi ne ko da yaushe.
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);
Sabuwar Sabuwar Sabuwar
A matsaloli a kan model name ya canza kamar yadda sarrafawa, ba tare da wani yanki. Suna aiki a kan full ids da short names, kamar yadda a cikin anthropic/claude-sonnet-5:online.
| Ƙara | Tuntube mu |
|---|---|
:online | Za ka sami a kan website, kamar yadda plugins: [{"id": "web"}]Ƙananan Wasanni. |
:thinking | High rage sha'awa; a nymbot/auto, ta hanyar ra'ayin. A kan wani model wanda ba zai iya ra'ayin, 400 model_not_found tare da “no endpoints found”. |
:nitro, :floor, :exacto, :extended | Kowane katako model yana da wani lalata, don haka ba zai zama mafi sauri, mafi kyau ko mafi tsawon da za a zabi; suffixes suna dace don model namu da aka sauke daga sauran sabis kuma yana aiki. |
Duk wani sauran sufifi ne ba tare. A cikakken sunan da aka ci gaba da farko, don haka wani model wanda ID yana da gaskiya yana da aiki; ba tare da wannan, sufifi suna dauka daga gudu daya a lokaci don wani model dauka. A model sunan za a iya zama a kowace 200 characters tsawon tare da a kowace 4 sufixes; a tsawon daya ne ba tare da 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);
Wasanni
Duk wani chat model zai iya magana daga yanar gizon. Nymbot zai search for latest user message (ya'akari 2,000 na farko), ya karanta mafi kyau pages da kuma ba su zuwa model tare da tambayoyi, da aka karanta a matsayin yanar gizo na yanar gizo ba za a yi magana daga. akwai biyu yanayin:
- Daidaitacce:
"plugins": [{"id": "web", "max_results": 5}], ko a:onlinesuffix a kan model. - Zama a lokacin da yana taimakawa:
"tools": [{"type": "web_search", "parameters": {"max_results": 5}}]Har ila yau, da aka samu a matsayinweb_search_previewkoopenrouter:web_search. Nymbot searches kawai a lokacin da tambayoyi yana da matsala da ya kamata a yanzu bayanai, da sama gwaji da app amfani.
max_results 5 kamar yadda yaushe, kuma a cikin mafi girma 10. A kayayyakin zauna a
nymbot.web_search.sourcesKowane tare da a title, snippet kuma
urlda kuma as url_citation Ayyukan bayanai a kan bayanai.
Kowane bincike da ke aiki da kudi $ 0.008, da aka canza zuwa sats, a kan tokens, kuma shi ne wani sassa. Sunan da ya karanta ne input tokens kuma, don haka yanayin daga yanar gizon yana da kudi fiye da wannan tambayoyi da aka ba da kowace, wasu lokacin da yawa fiye.
Yanar Gizo
"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);
Yanar Gizo
OpenAI ne mai sabon format, da aka amfani da OpenAI Agents SDK da Codex. Yana aiki a kan samfurin, sayarwa da siffofin kamar Chat Completions.
POST https://nymbot.ai/api/v1/responses - Yana bukatar wani API key.
| Wasanni | Ƙananan | Tuntube | Tuntube mu |
|---|---|---|---|
model | Tuntube mu | Ee | game da Tsarin ChatSuffixes hada da. |
input | string ko array | Ee | A string, ko list na abubuwa: messages (roles) user, assistant, system, developer) tare da input_text, input_image kuma output_text Parts, kuma function_call kuma function_call_output kayayyakin ga kayan aiki. input_image Yadda image_url Link ko data URL, ba tare da file id. reasoning kuma web_search_call kayayyakin da aka karfafa; item_reference Yadda ya refused. |
instructions | Tuntube mu | ko | Tsarin tsarin. |
max_output_tokens | Tuntube | ko | The most tokens don rubuta. |
temperaturetop_p | Sabuwar | ko | Sampling kudin, inda model ya samu su. |
toolstool_choiceparallel_tool_calls | array, string ko object, boolean | ko | Tsarin aiki na kayan aiki, a cikin Forms ({"type": "function", "name": …, "parameters": …}a) A web_search ko web_search_preview Tool Turns a kan Wasanni a lokacin da yana taimakawa. Ba da kayan aiki a cikin gida suna rike. |
reasoning | Tuntube mu | ko | {"effort": "minimal" | "low" | "medium" | "high"}. xhigh kuma max Ƙananan high; none Yadda za a yi. |
text.formatresponse_format | Tuntube mu | ko | Structured output, kamar wani JSON scheme ko json_object. |
metadata | Tuntube mu | ko | Sauke ba tare da ƙananan a cikin ƙananan. A cikin mafi girma 16 jerin, keys har zuwa 64 al'amari da kuma al'amari zuwa 512. |
stream | Wasanni | ko | Stream events kamar yadda ya rubuta a karkashin. |
store | Wasanni | ko | Ƙara. Duk wani abu ne ajiya, kuma sha'awar da yawa ya ce: "store": false. |
previous_response_idconversationbackground | Shafin shafi: Object, Boolean | ko | Bincike ba: 400 unsupported_parameter. Ayyukan ba zaune, don haka saita da dukan magana a cikin input Kowane lokaci. |
Yanzu
{
"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 }
}
A Tool Request ya nuna a output a matsayin function_call takardar shaida
call_id, name kuma argumentsSaduwa bayanai a matsayin a
function_call_output Mataki tare da wannan call_idReasoning, a lõkacin da model ya sa shi, shi ne a reasoning takardar shaida reasoning_text content, listed farko. status Ya incomplete Kuma a lokacin da matsaloli ya sa
max_output_tokens ko abokan ciniki ya ba da, tare da
incomplete_details.reason Yadda max_output_tokens ko
content_filterYanzu yana da faruwa da ƙirƙirar baƙi (temperature, kayan aiki, kayan yanar gizo, da dai sauransu) kamar yadda OpenAI ya yi, da kuma ƙirƙirar nymbot Ƙararrawa Objects.
Streamed, kowane event ne wani event: line da a data: line tare da a
sequence_numbera cikin wannan tsari: response.created,
response.in_progress, response.output_item.added,
response.content_part.addedDuk wani yawan response.output_text.delta,
response.output_text.done, response.content_part.done,
response.output_item.doneKuma a karshe response.completed tare da amfani da kuma kudin. A bayani cut short ends tare da response.incomplete maimakon, da kuma wani matsaloli bayan matsa lamba ya fara da response.failed. Reasoning streams kamar yadda wani abu tare da response.reasoning_text.delta kuma .done. Aikace-aikace-aikace-aikace suna bayan bayan bayanai, kowane a matsayin abubuwa tare da response.function_call_arguments.delta
kuma .done.
| takardar kebantawa | Kada |
|---|---|
400 | ko model ko input; previous_response_id, conversation, background ko item_reference (unsupported_parameter); wani kayan aiki ko content type ba tare. |
402, 403, 404, 429, 502, 503 | game da chat completions. |
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 sabuntawa
The format na Anthropic, ga Anthropic SDKs da Claude Code. Yana aiki tare da kowane model a cikin katako, ba kawai Claude: tambayoyi da aka fassara, ta hanyar sama pipeline, da kuma fassara.
POST https://nymbot.ai/api/v1/messages — bukatar wani API key, kamar yadda x-api-key ko Authorization: Bearer.
da anthropic-version kuma anthropic-beta Anthropic model names suna daidaita tare da catalog, don haka Claude Code da SDKs aiki tare da namu da suka yi amfani:
- wani sunan da aka sani, kamar yadda
claude-sonnet-5koanthropic/claude-opus-5Yana amfani da shi kamar yadda shi ne. - Yana da wani takardar (
-20260514),-latest, wani version tag kamar yadda-v1, wani bracketed tag kamar yadda[1m]a cikinanthropic/koanthropic.prefix suna daukawa, kuma dots da dashes a cikin version suna daidaita biyu (claude-haiku-4-5Kasaclaude-haiku-4.5). - Shin da haka ba za a yi amfani da al'ada (Opus, Sonnet ko Haiku), duk da cewa version na catalog ne sama ko sabon daga wanda aka ce.
- A sunan da ba ya dace ba tare da wani abu
404not_found_error.
| Wasanni | Ƙananan | Tuntube | Tuntube mu |
|---|---|---|---|
model | Tuntube mu | Ee | A catalog model id, ko wani Anthropic model sunan. |
max_tokens | Tuntube | Ee | The most tokens don rubuta. |
messages | Kasa | Ee | user kuma assistant Turns, tare da text, image (base64 ko URL kayan), tool_use kuma tool_result takardar kebantawa thinking Blocks daga gabatarwa da suka wuce suna dauke da kuma rufe. |
system | string ko array | ko | System prompt, a matsayin string ko rubutu block. |
temperaturetop_p | Sabuwar | ko | Sampling kudin, inda model ya samu su. top_k Ya dace da aka rufe. |
stop_sequences | Ƙungiyar Strings | ko | Tsarin da ke ba da matsaloli. A karkashin 4 jerin, kowane a karkashin 256 characters. |
toolstool_choice | daidaitacce, Object | ko | kayan aiki name, description kuma input_schemaa web_search Server Tool ya saita Wasanni; Anthropic's sauran built-in kayan aiki (bash, text editor, kwamfutarka amfani) suna ba tare da unsupported_tool. tool_choice Ƙara auto, any, tool ko noneda disable_parallel_tool_use. |
thinking | Tuntube mu | ko | {"type": "enabled", "budget_tokens": 8192}, {"type": "adaptive"} ko {"type": "disabled"}. The budget zaune wani tasiri: a karkashin 2.048 low, daga 2.048 low, daga 8.192 medium, daga 16.384 high. output_config.effortko high. |
stream | Wasanni | ko | Stream a cikin event format na Anthropic. |
metadata | Tuntube mu | ko | Takaddun shaida da kuma gyara. |
Yanzu
{
"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 Za ka iya samun tool_use Blocks da A thinking
Blocks, wanda signature Yadda za a iya. stop_reason Ya
end_turn, max_tokens, tool_use ko refusal, aiki tare da sama kamar yadda finish_reason ya
Tsarin Chat; stop_sequence Yana da
null, har ila yau, a lokacin da wani stop sequence ya haifar da matsaloli. input_tokens hanya tsari tsari; tsari tsari ne a cikin biyu kayan tsari. The kudade ne a cikin
nymbot Object da kuma X-Nymbot-Cost-Sats takardun
Streamed, abubuwa ne Anthropic's: message_start,
content_block_start, ping, content_block_delta
(text_delta, input_json_delta ko thinking_delta),
content_block_stop, message_delta tare da matsaloli, amfani da kuma nymbot Cost Object, kuma message_stopa ping tambaya a kowace 15 seconds yayin da model yana aiki. Aikace-aikace-aikace-aikace ya zo bayan lissafi, kowane a matsayin
tool_use block tare da cikakken input a cikin daya input_json_delta.
Errors a kan wannan endpoint amfani da format na Anthropic:
{"type": "error", "error": {"type": "not_found_error", "message": "…"}}A short Balance ne 402 billing_error, wani overloaded provider
503 overloaded_error. A matsaloli bayan matsa lamba da aka fara ne a matsayin error Yanar Gizo
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);
Takardar kebantawa
A ƙaddamar da yawa input tokens wani Messages ba za a yi amfani, don haka da abokan ciniki za a iya duba kafin ya sa. Yana ba tare da free, amma yana da bukatar key.
POST https://nymbot.ai/api/v1/messages/count_tokens — bukatar API key. Free.
Wasanni ne daidai da za a takardar kebantawaƘananan max_tokens; model sunan da za a gyara. A sayarwa ne wani sayarwa: alama na tsarin tsari, takardun shaida, kayan aiki tsari da kayan aiki mai sanyaya, plus 1,600 don kowane hotuna. Yana ba shi ne ba da tayin tokenizer, don haka da kyakkyawan sayarwa za a iya zama daban-daban. A key da aka samu da ƙarfi zai iya yin amfani da shi.
Yanzu
{ "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);
Lissafi da model
Kowane model da generator da API ta karɓar, tare da abin da ya dace. A list an saita daga cikin wannan live catalog da app na picker, don haka shi ne kowace server za a yi aiki.
GET https://nymbot.ai/api/v1/models — No key needed. Closed a kan 5 minti.
GET /api/v1/models/{id} Sauke wani entry.
| Wasanni | Ƙananan | Tuntube | Tuntube mu |
|---|---|---|---|
type | Wasanni (Query) | ko | chat (Ayyuka da ƙarfi) image, video, audio, embedding ko allDa yawa za a iya bayar, kamar image,video. |
The farashin ne abin da ka bayar, tare da farashin da marufi a, a dolara da kuma a sats a cikin yanzu Bitcoin farashin. balance ya ce abin da balans da model ya yi amfani.
nymbot_key shi ne short name na model a cikin app. created da yaushe 0 kamar yadda catalog ba ya rubuta a lokacin da wani model da aka ƙunshi. A model ba tare da aka gabatar da token farashin ne priceed per_request maimakon haka.
nymbot/auto da yawa na farko, price as variableKuma tare da a
routes listing da cewa kowane standard lalata farashin. Yana lists vision da ra'ayi, amma ba kayan aiki.
GET /api/v1/models/{id} dace da samfurori da alama a matsayin baƙi, da kuma ya ba da alama ga model da suka rufe a.
Yanzu
{
"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"
}
]
}
Ƙananan Ƙananan:
- Wasanni Yanar Gizo
capabilities(accepts_image_url,requires_image_url,edit) kuma wani farashinper_generation. - Wasanni Yanar Gizo
max_duration_secondskumaresolutionsKuma wani farashinper_secondga kowane hotunan. - Sauke Yanar Gizo
audio_typespeechkotranscriptionƘanananper_1k_charskoper_minute. - Ƙaddamar Yanar Gizo
dimensions,context_length,max_inputskuma wani farashin per miliyan input tokens.
Tarihi Marking "estimated": true ne takardun shaida na app ga wani generator wanda ya ba da farashin. type Kira 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);