Batayan ti pannakaammo Developer iti
Napateg dagiti mensahe.
Agipatpatarus kadagiti 3 a paraan a maaddaan iti modelo iti dadduma, iti 3 a format a nagtalinaedan dagiti kliente, ti adu a nairuar iti sama a model ken nairuar iti sama a way.
Daytoy a panid ket naipatarus babaen ti makina para iti kombeniente. Ti Ingles nga orihinal ti bersion nga agaplikar.
Napateg ti completion
Ti OpenAI chat format, ken ti nagpateg a tool ti nagpateg. Ipadala ti konversasion agingga iti dayta ket saan ti next message back.
POST https://nymbot.ai/api/v1/chat/completions Naaddaankami iti API Key.
ti model ken messages Ti maysa a sampling a parameter a ti napateg a model ket saan a nailawlawag ket saan a nailawlawag, tapno maaddaan iti maysa a request body iti adu a model. supported_parametersTi naudi ket ti naudi ket ti naudi ket ti naudi ket ti naudi ket ti naudi ti naudi ket ti naudi ket ti naudi ket ti naudi.
| Campo ti | ti | Naaddaankami | Kitaen dagiti ladawan. |
|---|---|---|---|
model | String iti | Wen | nymbot/auto ( iti auto) para iti Nymbot a ruter iti standard balance, wenno iti catalog model id kas anthropic/claude-sonnet-5 Kasapulantayo ti panangmatmatmo iti panangmatmatmo iti panangmatmatmo iti panangmatmatmo iti panangmatmatmo. Napateg. |
messages | Nagpintasen | Wen | Addaan iti role. system, developer (Mapantan iti sistema) user, assistant ken toolDaytoy ket maysa a list o list ti text ken image_url Napateg dagiti imbagana; naaddaankami iti user messages. input_audio Addaan iti file parts. |
stream | ti boolean | Ket | Kitaen dagiti ladawan. —Luc. Umadawtayo. |
stream_options | Objektona | Ket | {"include_usage": true} Agipatpatarus ti final a porma iti token count ken ti cost. |
max_tokensmax_completion_tokens | Napategda | Ket | Ti adu a token a nairekord. Naaddaankami iti maximum ti modelo no masursurotayo. Naaddaankami iti ad-adu pay nga agturay iti balanse, tapno maaddaan iti adu a numero a mangisursuro iti maawatan. |
temperaturetop_p | Numero ti | Ket | Impanna iti control: temperature 0 iti 2, top_p 0 iti 1. |
stop | Nalaing iti array. | Ket | Ti teksto a nagbaetan ti reaksion: maysa a string wenno iti maximum 4 strings, iti maximum 256 a karakter. nymbot/auto. |
seed | Napategda | Ket | Para iti repetitive sampling, saan a ti modelo ti suporta. |
presence_penaltyfrequency_penalty | Numero ti | Ket | Napateg dagiti kontrol, manipud -2 agingga iti 2. |
response_format | Objektona | Ket | {"type": "json_object"} ti {"type": "json_schema", "json_schema": {…}}Ngem saan a naaddaan iti model, saan a naaddaan iti model. nymbot/auto. |
toolstool_choiceparallel_tool_calls | Array, string wenno objekto, boolean | Ket | Naaddaankami iti funksiona. Pimmanaw iti calla ti web_search Nagturong iti Web iti SearchAgtawenak laeng iti 128 a tool ken 512 KB ti definisyon, agsipud iti agtawenak iti 64 a nivel. 400. |
reasoning_effortreasoning | Nagturong iti objekto. | Ket | "minimal", "low", "medium" ti "high"ti {"effort": "high"}. "none" ti {"enabled": false} Naaddaankami iti makita. Argumento ti. |
plugins | Nagpintasen | Ket | [{"id": "web", "max_results": 5}] Napalalo iti internet iti umuna a ruar.Map-up a 10 Results. |
n | Napategda | Ket | Kas pagarigan, saan a ti 400. |
logit_biasusermetadata | Nagturong iti string, object. | Ket | Naaddaankami ket inaramidda. logit_bias Mapud iti maximum 300 a token id iti numero manipud -100 agingga iti 100; user Agtawenak laeng iti 256 a karakter. metadata Agipatpatarus iti maximum 16 string values, keys agingga iti 64 a karakter ken values agingga iti 512. |
Addaan iti ordinary chat.completionAddaan iti cost in usage.cost
(Dollars) ken dagiti dadduma. nymbot Objektona iti model Daytoy ket addaan iti kaaduan kadagitoy no kalgaw.Ket ti kaaduan kadagitoy no kalgaw ket ti kaaduan kadagitoy no kalgaw. message.reasoning_contentNaaddaankami iti reaksion.
Reaksiona
{
"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 Kas pagarigan, saan a ti sumagmamano a saan a datayo, saan a saan a datayo a datayo: tool_calls Ngem idi inaramid ti instrumento, length Isu ket pimmusay idiay asideg ti Edinburgh, ken kadua met idi ti pamiliana. content_filter Ngem ibabaonnatayo ni Apo Dios a birukentayo isuna. stop
Addaan iti usage.completion_tokens_details.reasoning_tokens 0: Napatpateg a token ti panangmatmat iti argumento ket naidumduma, ken naidumduma iti completion_tokens.
| Status iti | ti |
|---|---|
400 | Ket model ti messages (missing_required_parameterDaytoy ket addaan iti kaaduan kadagitoy no kalgaw.unsupported_contentMaanadantayo dagiti kabaketan a pagsasaotayo (too_many_imagesDaytoy ket addaan iti kaaduan kadagitoy no kalgaw. (invalid_valueMaanadantayo dagiti kabaketan a pagsasaotayo (invalid_image_urlMaanadantayo dagiti kabaketan a pagsasaotayo (unsupported_tool); n Addaan iti 1; a :thinking Daytoy ket addaan iken ti kaaduan kadagitoy no kalgaw (model_not_found(Tumaudto dagiti adu a sinan-profeta a mangyaw-awan kadagiti adu a tattao.)upstream_rejected). |
402 | Ti balanse a gasto ti modelo ket saan a maipaay iti hold. |
403 | Daytoy ket addaan iken ti kaaduan kadagitoy no kalgaw (key_limit_reachedti inferior. max_tokens Naaddaankami iti cap. |
404 | Maanadantayo dagiti kabaketan a pagsasaotayo (model_not_found). |
429 | Nalawag ti kuna ti Biblia: “Asinoman a mangay-ayat iti kinaranggas pudno unay a guraen [ni Jehova].upstream_rate_limited). |
502, 503 | Maanadantayo dagiti kabaketan a pagsasaotayo (upstream_error(Tumaudto dagiti dadduma.upstream_overloadedti Retry-AfterDaytoy ket addaan iti kaaduan kadagitoy no kalgaw. |
Ti status code ti tunggal endpoint a aksion ket listado iti Addaan iti.
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 iti
ti "stream": true Daytoy ket addaan iti maysa nga addaan iti maysa nga addaan iti maysa nga addaan iti dua a daga.[1] chat.completion.chunk ti a data: Naaddaankami iti ruar, saan a nagturong iti data: [DONE]Naaddaankami iti reasoning.
delta.reasoning_contentIsu ti reaksion iti delta.content.
Agipatpatarus kadagiti adu a tattao nga agpatingga iti nasurok a 100 a segundo, kas iti maysa a lang a reaksion, iti maysa a
max_tokens Daytoy ket addaan iti kaaduan kadagitoy no kalgaw ti kaaduan kadagitoy no kalgaw.Idi linuktan ti kaaduan kadagitoy no kalgaw.Idi linuktan ti kaaduan kadagitoy no kalgaw.
Umadaw
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]
- Naaddaankami iti
:Kas 15 a sekreto, agipatpatarus ti panagturay iti panagturay. - Adu ti
"stream_options": {"include_usage": true}Napalalo ti ulidan iti ulidan, iti nakalugan achoicesAdda pay laeng ti sumagmamano a makisarita.nymbotObjektona iti - Ti pagbalinan ket naidumduma idi agtawen iti 25 a segundo, tapno maaddaanna ti token count ti provider, ken ti makabayad ti sumagmamano nga inlawlawag ti provider.
- Isu ket pimmusay idiay asideg ti Edinburgh.
401ti402Napateg a JSON, saan a naaddaan iti normal a JSON ken ti status code, ket saan a naaddaan iti stream.data: {"error": {…}}Ngem saan a nagpatingga ti stream ket saan a[DONE]. - Daytoy ket addaan iti kaaduan kadagitoy no kalgaw ti kaaduan kadagitoy no kalgaw.
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);
}
Inlawlawag ti
Agipatpatarus kadagiti funksiona tools Ngem saan a naaddaan ti sumagmamano a maaw-awagan ti funksion, saan a maaw-awagan. tool Kitaen dagiti ladawan.
tool_call_idTi Nymbot ket saan a nairekord iti funksion ti model.
tool_choice Napateg "auto", "none",
"required" ti {"type": "function", "function": {"name": "…"}}Nalawag ti kuna ti Biblia: “Asinoman a mangay-ayat iti kinaranggas pudno unay a guraen [ni Jehova].”capabilities.toolsTi instrumento ket naaddaan iti 400 unsupported_tool ti nymbot/auto Daytoy ket addaan iti maysa nga addaan iti maysa nga addaan iti maysa nga addaan iti dua a sebbangan.
ti "stream": true, maysa a request iti tool ket nairuar iti maysa a bit ket nairuar iti normal a chunk sequency: ti role, maysa a chunk a mangrugi ti tunggal tool call iti indeks, id, nagan ken argumento, ken ti finish chunk.
Addaan iti reaksion
"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);
Kitaen dagiti ladawan.
Modelo iti capabilities.vision Ngem saan a naaddaan iti foto. Add a image_url
Napateg ti user a mensahe, iti publiko. https:// link iti a
data:image/…;base64, Ti maysa a pagarigan ket ni Eliezer a nakaitalkan ti adu a sanikua ni David. (400 invalid_image_urlAddaan iti opsion. detail ti
auto, low ti high.
ti nymbot/auto, ti request iti maysa a picture iti maysa a standard model a makita. capabilities.vision Imbagana iti pictures with
400 unsupported_contentTi link ket addaan iti maysa a publiko a host; ti Nymbot imbagana ti imbagana iti provider ti model ket saan a maipaay iti dayta.
Ti imbagana ket nairuar iti input token ti provider, kas iti rest ti request.
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);
Argumento ti
Modelo iti capabilities.reasoning Ngem saan a maipakitatayo ti inaramidko, saanko a maipakitatayo ti inaramidko? reasoning_effort ("minimal", "low",
"medium" ti "high"ti "reasoning": {"effort": "high"}Agbiruk iti add :thinking Isu ket pimmusay idiay Malakanyang idiay Malakanyang idiay Malakanyang idiay Malakanyang. nymbot/auto, :thinking Naaddaankami iti standard reasoning route.
Iti Anthropic models, ti pagbalinan ket naaddaan iti agarup 1,000, 2,000, 8,000 wenno 16,000 a token, saan a maipaay iti nasurok a 1,000 a token. max_tokens Imbagana. – Imbagana ti imbagana iti
tool_choice Napateg a tool, ken kada ti requests ti panagturay iti tool loop (ti naudi a mensahe ket maysa a tool result), gapu ta ti Anthropic nangisubli ti naimbag a panagtalek a mangisubli iti dayta a panagturay.
Napateg ti argumento iti message.reasoning_contentti
delta.reasoning_content Isu ket pimmusay idiay asideg ti Edinburgh, ken kadua met idi ti pamiliana. completion_tokensTi dadduma a provider ket imbagana ti argumento a teksto, ket saan pay pay laeng.
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);
Impanna iti suffix
Ti sumagmamano iti nagan ti modelo ti panagtrabaho iti panagtrabaho iti solicitation, saan a saan a campo. anthropic/claude-sonnet-5:online.
| Addaan | Impanna iti |
|---|---|
:online | Nagturong iti web, kas plugins: [{"id": "web"}]ti Web iti Search. |
:thinking | Napalalo ti panangmatmatmo; iti nymbot/autoNgem saan a saan a mapagtalkan ti pamay-an a saan a mapagtalkan ti pamay-an, 400 model_not_found Ti kaudian ket ti “no endpoints found”. |
:nitro, :floor, :exacto, :extended | Dayta a modelo iti katalog ket addaan iti maysa a ruar, tapno saan a saan a maawagan, barato, wenno maawagan a ruar; dagiti sufixios ket naidumduma tapno maadaltayo dagiti modelo a kopia manipud iti dadduma pay a serbisio. |
Ti intero a nagan ket nailugan iti umuna, tapno maaddaan ti modelo a ti ID a nagkauna a nagkauna a nagkauna; no saan a, ti sufixium ket naidumduma iti umuna a panawen agingga a maaddaan iti maysa a modelo. 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);
Web iti Search
Ti Nymbot searches para iti maudi a user nga mensahe (ti umuna a 2,000 a karakter), makisarita ti best nga panid ket mangted kadagiti model iti question, a maragsakan iti external content a model ket saan a maaddaan kadagiti instruksion iti.
- Naaddaankami iti:
"plugins": [{"id": "web", "max_results": 5}]ti a:onlineNaaddaankami iti model. - Napukawanna iti tulong:
"tools": [{"type": "web_search", "parameters": {"max_results": 5}}]Kitaen dagiti ladawan.web_search_previewtiopenrouter:web_searchNymbot searches laeng idi ti isu ti nangisubli iti aktuara nga impormasion, ti maysa a test a nausar ti app.
max_results 5 Kasano a nagkauna a nagkauna a nagkauna iti daga?
nymbot.web_search.sourcesAddaan iti a title, snippet ken
urlti AS url_citation Kitaen dagiti ladawan.
Ti maysa a search a maaddaan iti $0.008, a konverted iti sats, iti top ti token, ket maysa a paset ti hold. The pages it reads are input tokens too, sa a reply from the web costs more than the same question asked cold, sometimes several times more.
Addaan iti reaksion
"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);
Agbiruk iti API.
Ti nauuna a format ti OpenAI, a nausar iti OpenAI Agents SDK ken iti Codex. Nairuar iti sama a model, billing, ken features ti Chat Completions.
POST https://nymbot.ai/api/v1/responses Naaddaankami iti API Key.
| Campo ti | ti | Naaddaankami | Kitaen dagiti ladawan. |
|---|---|---|---|
model | String iti | Wen | para iti Napateg ti completionNaaddaankami iti suffix. |
input | Nalaing iti array. | Wen | Daytoy ket addaan iti kaaduan kadagitoy no kalgaw. user, assistant, system, developerti input_text, input_image ken output_text Kitaen dagiti ladawan. function_call ken function_call_output Para iti instrumento. input_image Pimmanaw ti image_url Ti link wenno data URL, saan a ti file id. reasoning ken web_search_call Napateg ti item; item_reference Naaddaankami iti |
instructions | String iti | Ket | Instruksiona iti sistema. |
max_output_tokens | Napategda | Ket | Dinan kayat a kitaen dagiti dadduma. |
temperaturetop_p | Numero ti | Ket | Sampling controls, saan a ti modelo ti makisarita. |
toolstool_choiceparallel_tool_calls | Array, string wenno objekto, boolean | Ket | Nalaing ngamin idiay ayan ni Insan Crist ket isu a sabali dayta isemmo. ({"type": "function", "name": …, "parameters": …}ti a web_search ti web_search_preview Nagturong iti Web iti Search Ngem saan a naaddaan ti inaramidna, inaramidna ti inaramidna. |
reasoning | Objektona | Ket | {"effort": "minimal" | "low" | "medium" | "high"}. xhigh ken max Siguro high; none Naaddaankami iti |
text.formatresponse_format | Objektona | Ket | Naaddaankami iti JSON Scheme, wenno json_object. |
metadata | Objektona | Ket | Agipatpatarus iti 16 a strings, agipatpatarus iti 64 a karakter ken agipatpatarus iti 512. |
stream | ti boolean | Ket | Naaddaankami iti opisina. |
store | ti boolean | Ket | Isu ket inaramidna ti inaramidna, ket inaramidna ti inaramidna. "store": false. |
previous_response_idconversationbackground | Napalalo iti objekto, boolean. | Ket | Ti NALABAGA ket: 400 unsupported_parameterTi reaksion ket saan a maaddaan iti intero a konversa. input Nagpategda iti |
Reaksiona
{
"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 }
}
Napateg ti instrumento a naaddaan iti output ti a function_call Kitaen dagiti
call_id, name ken argumentsKitaen dagiti ladawan. a.
function_call_output Kitaen dagiti ladawan. call_idKas pagarigan, idi inaramid ti modelo, adda iti reasoning Kitaen dagiti reasoning_text Napategda iti listahan ti umuna. status ti incomplete Ngem idi ti reaksionna
max_output_tokens Ngem ibabaonnatayo ni Apo Dios a birukentayo isuna.
incomplete_details.reason Addaan iti max_output_tokens ti
content_filterTi reaksion ket naaddaan kadagiti setting ti request (temperatura, tool, tool choice, etc.) kas ti OpenAI, ken mangrugi ti nymbot Nagpintas ti objekto.
Nagpintas, ad-adu pay laeng ti evento event: ti line a data: Addaan iti a
sequence_numberKitaen dagiti ladawan. response.created,
response.in_progress, response.output_item.added,
response.content_part.addedAddaan iti numero response.output_text.delta,
response.output_text.done, response.content_part.done,
response.output_item.doneNapateg ti response.completed Adda pay laeng ti sumagmamano a sumagmamano a mangngeg iti korte end. response.incomplete Ngem saan a nagpateg a nagpateg ti stream. response.failedNgem saan a nagpateg a kas iti tema ti response.reasoning_text.delta ken .doneDaytoy ket addaan iti kaaduan kadagitoy no kalgaw. response.function_call_arguments.delta
ken .done.
| Status iti | ti |
|---|---|
400 | Ket model ti input; previous_response_id, conversation, background iti item_reference (unsupported_parameter); ti maysa a tool wenno ti tip ti content a saan a naaddaan. |
402, 403, 404, 429, 502, 503 | Kas iti completion chat. |
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);
Naaddaankami iti mensahe.
Ti format ti Anthropic, para kadagiti Anthropic SDKs ken Claude Code. Naaddaan iti tunggal model iti katalog, saan a naaddaan ti Claude: ti solicitation ti nailawlawag, ti nairuar iti maysa a pipeline, ken ti nailawlawag.
POST https://nymbot.ai/api/v1/messages Naaddaankami iti API key. x-api-key ti Authorization: Bearer.
ti anthropic-version ken anthropic-beta Ti antropoid a nagan ti modelo ket maaddaan iti katalogo, tapno maaddaan ni Claude Code ken dagiti SDK kadagiti nagan a maawagan:
- Napateg dagiti katalogo, kas
claude-sonnet-5tianthropic/claude-opus-5Naaddaankami iti dayta a tao. - (Tumaudto dagiti dadduma.
-20260514),-latestKitaen dagiti ladawan.-v1Isu ket pimmusay idiay asideg ti Edinburgh.[1m]ti ananthropic/tianthropic.Daytoy ket addaan iti kaaduan kadagitoy no kalgaw. (claude-haiku-4-5Nalpasakonclaude-haiku-4.5). - No saan a maadaltayo, maadaltayo ti familia (Opus, Sonnet, Haiku) no saan a maadaltayo ti bersion ti catalogo.
- Daytoy ket addaan iken ti dadduma.
404not_found_error.
| Campo ti | ti | Naaddaankami | Kitaen dagiti ladawan. |
|---|---|---|---|
model | String iti | Wen | Nalaing ti catalog model id, wenno ti antropic model name. |
max_tokens | Napategda | Wen | Dinan kayat a kitaen dagiti dadduma. |
messages | Nagpintasen | Wen | user ken assistant Nagturongda, iti text, image (Base64 wenno URL a kunkunana) tool_use ken tool_result Blokado iti thinking Napateg a block ti nakalipas a turnos ket naidumduma. |
system | Nalaing iti array. | Ket | System prompt, kas a string wenno teksto a blok. |
temperaturetop_p | Numero ti | Ket | Sampling controls, saan a ti modelo ti makisarita. top_k Naaddaankami iti kasta. |
stop_sequences | Addaan iti strings. | Ket | Agtawenak laeng iti 4 a strings, iti maximum a 256 a karakter. |
toolstool_choice | Nagturong iti objekto. | Ket | Instrumento ti name, description ken input_schemaa ti web_search Addaan iti server tool. Web iti Search, ti dadduma a built-in a tool ti Anthropic (bash, text editor, computer use) ket inlawlawag iti unsupported_tool. tool_choice Napateg auto, any, tool ti noneti disable_parallel_tool_use. |
thinking | Objektona | Ket | {"type": "enabled", "budget_tokens": 8192}, {"type": "adaptive"} ti {"type": "disabled"}Ti budget ket nalawag a nivel ti effort: manipud iti 2,048 a minimum, manipud iti 2,048 a low, manipud iti 8,192 a medium, manipud iti 16,384 a high. output_config.effortNaaddaankami iti high. |
stream | ti boolean | Ket | Agipatpatarus iti antroposia. |
metadata | Objektona | Ket | Naaddaankami iti ignorant. |
Reaksiona
{
"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 Pimmanaw ti tool_use Blokko iti a thinking
Blokko ti signature Naaddaankami iti vacuum. stop_reason ti
end_turn, max_tokens, tool_use ti refusalNapukawanna iti sama a finish_reason ti
Napateg ti completion; stop_sequence ti always
null, uray no ti stop a sequency ti panagturay ti reaksion. input_tokens Ipapaupana ketdi ti kaaduan kadagitoy no kalgaw.
nymbot Objektona iti X-Nymbot-Cost-Sats Addaan iti header.
Daytoy ket addaan iti Anthropic’s: message_start,
content_block_start, ping, content_block_delta
(text_delta, input_json_delta ti thinking_delta),
content_block_stop, message_delta Isu ket pimmusay idiay asideg ti Edinburgh, ken kadua met idi ti pamiliana. nymbot Adda pay laeng objekto, ken message_stopa ti ping Naaddaankami iti 15 a sekundada a nagbaetan ti instrumento a nairekord iti teksto.
tool_use Napateg a blok iti intero a input iti maysa input_json_delta.
Error iti daytoy a terminal nausar ti format ti Anthropic:
{"type": "error", "error": {"type": "not_found_error", "message": "…"}}Addaan iti short balance. 402 billing_errorAddaan iti Supplier.
503 overloaded_errorNgem saan a nagpateg ti inaramidna, inaramidna ti inaramidna. error Nagturong iti event.
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);
Agbiruk iti token.
Ti panangmatmat ti innem a token a mangusar iti mensahe a request, tapno maaw-awagan ti client tapno maaw-awagan ti mensahe. It’s free but still needs a key.
POST https://nymbot.ai/api/v1/messages/count_tokens Naaddaankami iti API Key.
Kas pagarigan, adda makaay-ayo iti Kitaen dagiti ladawan.Isu ket max_tokensDaytoy ket addaan iti kaaduan kadagitoy no kalgaw ti kaaduan kadagitoy no kalgaw.Idi linuktan ti kaaduan kadagitoy no kalgaw.Idi linuktan ti kaaduan kadagitoy no kalgaw.
Reaksiona
{ "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);
Modelo ti
Kas iti model ken generator ti API, saantayo a makisarita. Ti lista ket naaddaan iti sama a live catalog ken ti app nga picker, tapno maaddaan iti server.
GET https://nymbot.ai/api/v1/models No isu ti inaramidna, lima a minuto ti inaramidna.
GET /api/v1/models/{id} Agbiruk iti 1 entry.
| Campo ti | ti | Naaddaankami | Kitaen dagiti ladawan. |
|---|---|---|---|
type | Agbiruk iti query. | Ket | chat Kitaen dagiti ladawan. image, video, audio, embedding ti allAdda pay laeng ti sumagmamano, kas image,video. |
Ti presyo ket ti pagbayad, babaen ti fee ken margin nga adda, iti dollar, ken iti sats iti current Bitcoin price. balance Addaan iti balanse ti gasto ti modelo.
nymbot_key Daytoy ket addaan iti short name iti app. created Dayta ti 0. idi ti katalog ket saan a na-record kada ti model ket naiduma. per_request saan ketdi a.
nymbot/auto Ngem saan a nagpateg a nagpateg a kas variableti a
routes Napateg a ruar ti ruar ti ruar ti tunggal standard. Napateg a ruar ti vision ken argumento, ngem awan ti instrumento.
GET /api/v1/models/{id} Napateg dagiti dadduma a nagan ken alias a nangikabil iti peticion, ken imbagana ti impormasion para iti modelo a nangikabilda.
Reaksiona
{
"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"
}
]
}
Ti dadduma a tipo:
- Imbagana Addaan iti
capabilities(accepts_image_url,requires_image_url,editAddaan iti priceper_generation. - Video ti Addaan iti
max_duration_secondskenresolutionsAddaan iti priceper_secondPara iti resolution. - Audio iti Addaan iti
audio_typespeechtitranscriptionNagpateg aper_1k_charstiper_minute. - Agbiruk Addaan iti
dimensions,context_length,max_inputsAdda pay laeng iti milion a input token.
Impanna iti markup "estimated": true Daytoy ket addaan iti maysa a generator, a ti maysa a generator ket addaan iti maysa a generator. type Pimmanaw 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);