Huruw kɔ emu nsɛm no so
San kɔ Nymbot

Nimdeɛ a wɔde gyina so Akanfoɔ a wɔyɛ adwuma a wɔyɛ nneɛma foforɔ

Kasa, Nkabom ne Makata

Kwan etɔɔ so mmiɛnsa a wobɛbisa model bi biribi, wɔ kwan mmiɛnsa a akyɛdeɛfoɔ kã no so ankasa, ne nyinaa rekɔ so wɔ model no ara so na wɔbɛkyɛ no akɔsi kwan baako so.

Kasa Mu Nneɛma

OpenAI chat nhyehyɛ mu kwan no, ne nea ɛyɛ sɛ aduru biara a ɛwɔ hɔ kura no. Twɛ sɛ asɛm no kɔ so no na fa nea ɛba nkyɛn no firi hɔ fi.

POST https://nymbot.ai/api/v1/chat/completions — hia API key bi.

Nkoaa model ne messages ɛsɛ sɛ wɔde wɔn. Sampling parameter a ɔde kɔmponi a wɔahyia no ntumi nnye no, wɔde twaa no ase sɛ ɛnyɛ nneyɛeɛ bi, enti request body baako no bɛtumi adi dwuma wɔ komponi ahorow nyinaa so. Komponi list no ma ɔkomponi biara ne supported_parametersƐde nneɛma a model no ntumi nyɛ biara koraa na ɛyɛ nea wɔa to nneɛma no to nkyɛn na ɛnyɛ de twa wɔn: mfonini ma model a ɔntumi mmu mfonini no, nneɛma a ɛboa ma model a ɔntumi di wɔn dwuma no.

Akwantuo kwanTwerɛƐsɛ sɛ wɔde di dwumaNkyerɛkyerɛmu
modelntɛntɛnAanenymbot/auto (anɔpa auto) Nymbot routing wɔ standard balance no so ma, anaa catalog model id bi te sɛ anthropic/claude-sonnet-5 Pro balance no so. Wubetumi de app no din kɔkɔɔ ne ne din foforo bi nso di dwuma. Ebia ɛbɛtumi ahi a. atɛmmuo.
messagesarrayAaneNsɛm no. Dwumaden. system, developer (yɛde agye n'anim), user, assistant ne tool. Content yɛ string anaa list bi a ɛwɔ text ne image_url nneɛma; mfonini nkoaa wɔ mpaebɔ mpanin mu. input_audio na mfuawie nneɛma nnyɛ kwan.
streambooleanDaabiMa nkyerɛkyerɛmu no akɔ so sɛnea wɔatwerɛ no. Hwɛ nsuo bɔ mu kɔ so nsuo mu nsuo kɔ so.
stream_optionsadeɛDaabi{"include_usage": true} Ɛhyɛ awieɛtɔɔ bi a ɛwɔ token nkontaa ne nnyigyeɛ.
max_tokens
max_completion_tokens
namba a ɛnyɛ nanteɛ nambaDaabiNkyerɛwee tokens a ɛtɔ mmirika paa. Yɛde ɛnoɔ kɔ model no kɛseɛ paa mu sɛ ɛyɛ kɛseɛ a. Ɛyɛ ɛno nso na ɛkyerɛ sɛnea wɔfa wo sika nkyɛn fa, enti sɛ ɛyɛ nkontaa kɛseɛ a, ɛhia credit ketewa paa sɛ wobɛtumi abue.
temperature
top_p
nɔbaDaabiNneyɛe a wɔfa nkyekyɛmu so di: temperature fi 0 kɔ 2, top_p fi 0 kɔ 1.
stopstring anaa arrayDaabiTete a ɛma mmua no: string ɔmfa string ebɛn 4, nea biara nyɛ maba mfeɛ 256. Yɛnsɛe mma nymbot/auto.
seednamba a ɛnyɛ nanteɛ nambaDaabiƐpono amansan nteteeɛ no ho, ɛba sɛ model no twaa mu kwan bi wɔ hɔ no.
presence_penalty
frequency_penalty
nɔbaDaabiAkwantu mu nidi a ɛhyɛ aseɛ fi -2 kɔsi 2.
response_formatadeɛDaabi{"type": "json_object"} annaa {"type": "json_schema", "json_schema": {…}}, ɛhe a model no de twaa so. Yɛn de nnyɛ nymbot/auto.
tools
tool_choice
parallel_tool_calls
array, string anaa object, booleanDaabiDwuma frɛ. Hwɛ nkɔtoo mfonini. A web_search ntoma no hyɛ aseɛ web nwosɛeɛƐfiri mfifidi 128 ne nkyerɛkyerɛmu 512 KB, ɛkyerɛ mfifidi a wɔahyia mu kɔsi mfɛa 64; ɛka bi a ɛdɔɔsoɔ yɛ 400.
reasoning_effort
reasoning
string, nneɛma a ɛwɔ muDaabi"minimal", "low", "medium" annaa "high", anaa {"effort": "high"}. "none" annaa {"enabled": false} ɛtwerɛ no. Hwɛ nkɔsoɔ.
pluginsarrayDaabi[{"id": "web", "max_results": 5}] daadaa ɛnyɛ deɛ ɛhwehwɛ web no anim antdaa. Nsuae pii dwumadie mmiensa dwumadie 10.
nnamba a ɛnyɛ nanteɛ nambaDaabiƐhɔ sɛ 1 nkoaa. Biribi foforɔ biara de ɛba 400.
logit_bias
user
metadata
adeɛ, asɛm, adeɛDaabiWaa akɔɔ a wɔannyae na wɔannkyɛe. logit_bias de token id mfonini no nyinaa nnye 300 kɔ nɔmɔdii a ɛfi -100 kɔ 100; user ɛyɛ nkɔmmadom mmienu (256) kɔsi mmienu mmienu; metadata ɛwɔ mmuaeɛ nkontaa 16 a ɛdi kan kɔ so, nkyerɛkyerɛmu nkontaa kɔsi nkrakra 64 na mmuaeɛ nkontaa kɔsi nkrakra 512.

Abasobɔdeɛ no yɛ adeɛ a ɛnyɛ soronko chat.completion, ne ahoɔden wɔ usage.cost (sika dollar mu) na wɔwɔ mu no nymbot adeɛ. model ɛno ne model id a wɔatumi ahyɛ aseɛ no, anaa ɛno kyerɛ sɛ mfonini fitaa bi bɛba sɛ mfonini kɛseɛ no. Sɛ model no akaeɛ ansa na ɔanya mmuaeɛ a, ne akaeɛ no wɔ wɔn mu message.reasoning_content, mfitiaseɛ no nkyɛn.

Aboa mu nkyerɛaseɛ

{
  "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 yɛde ɛfrɛ nea ɛbae no mmoa afiri sɛnea nnyigyeɛfoɔ bɔ amanneɛ foforo: tool_calls sɛ mɔdèl no bɛpɛɛ nneɛma a wɔde yɛ adwuma, length berɛ a mmuaeɛ no fae kwan biara a wɔahyɛ no ama (anaa model no de wɔn nyinaa di dwuma wɔ nneɛma a ɛsɛ sɛ ɔsua mu na ɔmmua mmuaeɛ), content_filter nea ɔdomfo no deɛ agyaeɛ no, na stop Sɛ ɛnyɛ saa a. usage.completion_tokens_details.reasoning_tokens ɛyɛ 0 daa: ahiahyɛdeɛ nhwɛmu neɛ tokens no wɔn mmoa, na wɔto wɔn ahosoɔ, wɔ completion_tokens.

ƐdaeɛƐberɛ bɛn?
400Daabi model annaa messages (missing_required_parameter); asoɔdeɛ an nhoma fã, annea mfonini ma model a ɔntumi nnya wɔn a (unsupported_content); mfonini aduo kɔ so (too_many_images); sampling parameter akyɛdeɛ a ɛnyɛ nea ɛsɛ ani anaa ɛdi mfeɛ a ɛda mu (invalid_value); ebɔ mmara mu mfonini link a ɛnyɛ mpɔtam (invalid_image_url); nneɛma a ɛwɔ model bi so a nea ɔntumi nfrɛ wɔn (unsupported_tool); n 1 firi no, a :thinking mmoadeɛ a ɔntumi nkyerɛaseɛ ɛpon sɛnea ɛte sɛ (model_not_found); anaa ɔtayɛfoɔ no toɔɔ mpaeɛ no (upstream_rejected).
402Model no akonta a ɔde di dwuma no ntumi nnya hold no so.
403Neɛma a ɛyɛ mpaɔ ne nea ɛyɛ mpaɔ mma key cap no (key_limit_reachedSi ase max_tokens anaa ma mmerɛ no nka sɛnea ɛbɛyɛ a.
404Ɛnyɛ model bi a ɛwɔ saa din no so (model_not_found).
429Key no rate limit no, anaa provider no (upstream_rate_limited).
502, 503Odomfo no nantee wɔ hɔ (upstream_error) anaa ɛyɛ nneɛma pii a ɛkyerɛ ne ho (upstream_overloaded, ne Retry-After). Ɛnni biribi a wɔbɛkyɛ wo nsa, sɛ provider no nkyɛeɛ wɔ ɔhwɛ no so no ara.

Status code biara a endpoint biara de yɛ no wɔatwerɛ no ase wɔ nsɛnsɛeɛ.

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

Ananteɛ

Ne ho "stream": true mmuae no ba sɛ server-sent events wɔ mɔdenbɔ no ase kɔre no. Adeɛ biara yɛ a chat.completion.chunk wɔ bi a data: ɛtɔ, na ɔtwe no ɛba data: [DONE]Nkaesɛm ba mu delta.reasoning_content, mmuaeɛ no wɔ delta.content.

Ma nneɛma biara a ɛbɛtumi ayɛ nnɔbɔɔ nson nketewa (100) so, te sɛ mmuae tenten anaa biribi kɛseɛ... max_tokens anommmɔdeɛ bi anaa nneɛma a ɛhunu ansa na ɛkasa. Asɛm bi a ɛmfa stream ho nni mmere no, ɛnyɛ nneɛma biara nsofa kɔ ansa na asɛm no awie; na n'akwan a ɛda wo ne Nymbot ntam no bɛtumi agya n'akwan no a ɛmma no nnyɛ adwuma biara wɔ sae a ɛrekɔ so ansa na ɛahyɛ no mfeɛ 100; model no bɛwie na nea ɔtwere no no nna, nanso asɛm no bɛpira. Stream no nso ma asɛm no kɔ so nkyerɛ n'akwan sɛ ɛrekɔ so, enti ɛhyɛ aseɛ kɔsi sɛ model no bɛwie ne nea ɔretwerɛ no.

Nsuo a ɛretu

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]
  • Asɛm nkyerɛwee a ɛhyɛ aseɛ ne : adaka-ahyɛ bi wɔ hɔ a wɔde ma mmoa a ɛtena hɔ, wɔde ma wɔn biara wɔ mpɛn 15 biara wɔ mpoasɛm no mu a model no resusuw no. SSE clients nnye wɔn.
  • Frɛ "stream_options": {"include_usage": true} sɛ wopɛ sɛ wosi ahennie a ɛwɔ aseɛ no, ɛnna ɛnyɛ biara choices, token nkontaa no, nsesaeɛ no, ne... nymbot adeɛ.
  • Ɔdenka no hyɛ mu berɛ a stream no awie. Sɛ wopira kɔtakata no anante a, yɛmma model no nka nnyɛ: Nymbot kontinu ɔkenkan provider no stream no ahorow no, ɛtɔ miremme 25 mu, sɛ ɔbɛnya ne token count no, na wopae nea provider no ka no. Sɛ saa count no nni hɔ a, wɔfa w'adwene ne nea wɔatwerɛ no so de hyɛ ɔdenka no mu, ne model a ɔhwɛ ne ho kwan no output allowance no nyinaa.
  • Nkyerrɛmu bi ansa na nea ɛdi kan no, te sɛ 401 annaa 402, ɛsan ba sɛ JSON a ɛyɛ soronko ne ne status code, ɛnyɛ sɛ stream. Error bi a ɛba a stream no asan, ɛba sɛ ne a ɛtɔɔ data: {"error": {…}} asɛm no, na mfaso no ɛkɔ no a ɛnni Ɛ? [DONE].
  • Nnyinasoɔ a ɛwɔ nneɛma a wɔde yɛ adwuma ne model bi a ɛwɔ OpenAI's Responses transport no, ɛnnyɛ wɔn fi aforɔfo no nkyɛn kɔ so (stream). Sɛnea ɛteɛ ne sɛ wɔde anidasoɔ a ɛyɛ nokware bi kɔma wo, bere a ɛbɛyɛ mu no.

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

Nneɛma a wɔde di dwuma

Kyerɛ mmɔdenbɔdeɛ wɔ tools na model no ntumi aka sɛ wɔfrɛ bi wɔde abue asɛm no, na mmom sɛ ɔbɛbua no. Woyɛ function no, na wode ne nkyerɛkyerɛmu no hyɛ mu sɛ tool adesua a ɛwɔ ne ho ara no tool_call_id, na kɔma asɛm no bio. Nymbot annyɛ wo nnwuma mu koraa; ɔde model no asɛm no kɔ ma wo nso.

tool_choice fa "auto", "none", "required" annaa {"type": "function", "function": {"name": "…"}}. Model list no kyerɛ model bɛn na wɔn werɛ mfa nneɛma (tools) di dwuma (capabilities.tools) Nneɛma no yɛane ne 400 unsupported_tool ɔn nymbot/auto na wɔn mfinimfini kwan a wɔde kɔtɔ kɔtɔ mu mfeɛ a ɛyɛ kakra a wɔde OpenAI's Responses transport te, a Nymbot ntumi mmua nsɛm nnyɛ adwuma kɔ mu.

Ne ho "stream": true, nsɛm a ɛfa nneɛma a yɛde yɛ adwuma ho, ɛyɛ biribiara pɛ na ɛfa kwan bi so na wɔatuma no sɛ nneɛma a ɛrekɔ so tiawa tiawa: ɛno yɛ role no, nneɛma tiawa bi a ɛda nneɛma a yɛde yɛ adwuma biara ho ne ne index, id, din ne ne nea ɛfa ho (arguments), na ɛtɔ mpo finish chunk no. Afoforɔ a wɔtumi nneɛma a ɛrekɔ so tiawa tiawa no, wɔyɛ no sɛnea wɔyɛ no daa no.

Mmuaeɛ, ɛdom nkyɛn bi

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

Nsɛm hyɛ bi mu mfonini

Mmuaeɛ a ɛwɔ ne ho ne capabilities.vision ɔtumi akenkan mfonini. Hyɛ bi image_url nkyɛn a ɔde ma obi a, nea ɛne obi pɔ mpo sɛ ɛbɛyɛ kɛseɛ https:// link anaa a data:image/…;base64, URL. Dwumadi biara mu nkyɛn mfeɛ 20 nkyɛn. Yɛrefire SVG nkyɛm, na ɛsɛ sɛ link no nnyɛ mfeɛ 4,096 a ɛdi so anaa link a ɛwɔ ɔdomfo din anaa password wɔ mu (400 invalid_image_url). Ɛholɔdeɛ a ɛnyɛ ɔmanduo detail ɛyɛ auto, low annaa high.

Ne ho nymbot/auto, mpaebɔ a ɛwɔ mfonini bi mu no kɔ ma mmodel a ɔbɛtumi ahu ade no. Catalog model a ɛnni nso capabilities.vision ɔrefuse pictures ne 400 unsupported_content. Pictures nkoaa wɔn wɔ mpaebɔ mu. Link no nnye kwan ma ahoɔden mu nipa; Nymbot ma awiehyɛ no kɔ mmoafoɔ kwan mu na ɔnnyɛ no wɔ ne nidi mu.

Sɛe mfoni bi bɛba a, nkyerɛkyerɛmufo no bɛtena ne nkyerɛkyerɛmu mu nneɛma (tokens) a ɛwɔ mu so sɛ ne nneɛma a ɛwɔ asɛm no nyinaa mu so te sɛ no.

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

Adwene mmuaeɛ

Mmuaeɛ a ɛwɔ ne ho ne capabilities.reasoning wɔn ntaa ansa na wɔasesa. Kyerɛ wɔn sɛ ɛnyɛ pii anaa ɛnyɛ bɔne bi wɔ ne ho ne reasoning_effort ("minimal", "low", "medium" annaa "high") anaa "reasoning": {"effort": "high"}, annaa hyɛ :thinking adesua kɔ adesua mpanin din no, ɛyɛ sɛ adwuma bɔɔ sɛnea ɛsɛ sɛ yɛyɛ no. De adesua mpanin a ɔnni nneyɛeɛ nteaseɛ no, nkyerɛkyerɛ no wɔ nnyigyeɛ mu nti wɔammu no. Nea ɛwɔ nymbot/auto, :thinking ma dwidwidi no kɔ standard reasoning route no so.

Wɔ Anthropic models mu no, adwuma no kɔ so sɛ nteaseɛ nnyinasoɔ a ɛwɔ tokens 1,000, 2,000, 8,000 anaa 16,000 nka, ɛnyɛ kɛseɛ sen saa biara. max_tokens ma wo fa. Nnɛmfɔtwɔ nnye hɔ wɔ sɛnea... tool_choice ɛkyerɛ adeɛ bi, na sɛ asɛm no kɔ so ma adeɛ bi kɔ so anadwo (ne akyiri no nkyerɛaseɛ ne adeɛ bi nti), ɛnam sɛ Anthropic hia nkyerɛaseɛ a wɔayi no akyiri no sɛ wɔbɛtumi aka so bio nti. Adeɛ yi kɔ so ne Responses ne Messages endpoints no nso.

Nnyinasoɔ no san ba mu message.reasoning_content, anaa delta.reasoning_content berɛ a woretu video anaa audio so no, mma ɛnye mfomsoɔ wɔ mmuaeɛ no mu. Nkaeɛ ne nteaseɛ ne nea wɔdema wo nkyɛm no, na wɔkyɛ no sɛ ɛyɛ adeɛ a ɛwɔ nea wɔdema no mu. completion_tokensƐtɔ da a, ɛda biara mmafoɔ biara nnyɛ adeɛ sɛ wɔde n'asɛm aka no bɔ ne ho kwan biara, nanso wɔgye wo sika no ara.

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

Model nkyɛnmu ne nkyɛnmu nnyinasoɔ

Model din mu nkyerɛwee bi bi a ɛsesa sɛnea wɔhwɛ asɛm no, ɛnyɛ afutuo foforɔ bi a ɛwɔ ɛkan biara mu a. Wɔde wɔn bɔ mmɔden wɔ idifoɔ a wɔwɔ hɔ nyinaa ne din a ɛyɛ tiawa bi ne sɛnea ɛte saa, sɛnea ɛte sɛ anthropic/claude-sonnet-5:online.

Nkyɛn-hyɛNtiribi
:onlineWeb ho nnoofoɔ hwɛeɛ ansa na ɛbɛyɛ sɛ, te sɛ plugins: [{"id": "web"}]. Hwɛ web nwosɛeɛ.
:thinkingNteteeɛ adwumaden kɛse; ɛnyɛ nymbot/auto, adwene nneyɛe kwan no. Model a ntumi nnyɛ adwene nneyɛe so, 400 model_not_found ne “no endpoints found”.
:nitro, :floor, :exacto, :extendedYɛayi no ase na wɔatwam no. Catalog model biara wɔ kwan baako, enti ɛnyɛ kwan a ɛyɛ ntɛm, a ɛyɛ mmerɛw, anaa a ɛyɛ tenten bi a yɛbɛtumi afeti; suffix no wɔ akomadeɛ mu na ɛte sɛnea model din a wɔato afi yɔnko dwumadie mu no bɛtumi ayɛ adwuma ara.

Wofiri biara nnyɛ aduane. Wɔhwɛ din no nyinaa ankurunnuw ankurunnuw fɔtɔ kɔmɔ no, enti model a ne id no wɔ kɔmɔ (colon) wɔ mu no bɛtumi ayɛ adwuma; sɛ ɛnyɛ saa a, wɔyi suffix no fi ɛtɔɔ mpo kɔsi sɛ model bi bɛba; model din bi bɛtumi ayɛ mpaa 200 kɔsi, na suffix nna ɛnyɛ mpaa 4 kɔsi; sɛ ɛyɛ ɛnkɔɔ saa a, wɔama no mpaa kyerɛ sɛ 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);

Chat model biara bɛtumi de asɛm bɛhyɛ mfomsoɔ afi internet no so aninga. Nymbot hwehwɛ ne dwetɛmpɔn a ɔde kyerɛɛ no afi mpaebɔ no mu (ne mfeɛ 2,000 a ɛdi kan no), ɔkenkan afinaa mpaebɔ no mu ne mpaebɔ no kyerɛ model no, na ɔde kyerɛ sɛ ɛnyɛ dwumadie bi a model no nnye afom firi mu. Wɔ mode mmienu wɔ hɔ:

  • Da biara hwehwɛ: "plugins": [{"id": "web", "max_results": 5}], ani sɛ a :online model no nkyɛnkyɛn wɔ no so.
  • Hwɛhwɛ berɛ a ɛboa: "tools": [{"type": "web_search", "parameters": {"max_results": 5}}], ɛso sɛ wɔne ato sɛ web_search_preview annaa openrouter:web_search. Nymbot hwɛ wɔ hɔ a asɛm no te sɛ ɛhia nkabom nkyerɛkyerɛmu a ɛda anɔpa yi, ɛno ara na app no nso hwɛ.

max_results ɛyɛ 5 sɛnea wɔahyɛ no mu na ɛnyɛ dɔɔso 10. Nneɛma a ɛfiri mu no ba... nymbot.web_search.sources, obiara wɔ a title, snippet ne url, na sɛ url_citation nteteeɛ ne mpaebɔ wɔ mpaebɔ no so.

Dwɛ twatwa biara a ɛyɛ dwuma no, ɔkyerɛ sɛ ne nnyigyeɛ no yɛ $0.008, a wɔasɛe ase sɛ sats, ɛfiri tokens no so kɔ, na ɛyɛ hold no ase kɔm. Afã a ɛkaa no nso yɛ input tokens, enti sɛnea web no firi mu mmuae bi bɛyɛ no, ɛyɛ kɛse sen sɛnea wubɛbisa asɛm no sɛ wampɛ nso, ɛtɔ mmerɛ pii kɔ so.

Mmuaeɛ, ɛdom nkyɛn bi

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

Responses API

OpenAI nkabom foforɔ a, wɔde di dwuma wɔ OpenAI Agents SDK ne Codex mu. Ɛyɛ dwuma wɔ adwuma ne nneɛma a ɛho ahoɔden ne nneɛma a ɛdi Chat Completions akyi.

POST https://nymbot.ai/api/v1/responses — hia API key bi.

Akwantuo kwanTwerɛƐsɛ sɛ wɔde di dwumaNkyerɛkyerɛmu
modelntɛntɛnAaneƐfa Kasa Mu Nneɛma, ɛkyɛnneɛ a wɔahyɛ mu deɛ.
inputstring anaa arrayAaneNkyerɛwee bi, anaa nneɛma mmuae: messages (roles user, assistant, system, developer) ne input_text, input_image ne output_text nkyekyɛmu, na function_call ne function_call_output nneɛma a wɔde yɛ adwuma nneɛma. input_image fa bi image_url link anaa data URL, ɛnyɛ file id. reasoning ne web_search_call Nneɛma no atwa; item_reference Yɛaye n'ani so.
instructionsntɛntɛnDaabiSika kɔtɔ nkyerɛkyerɛmu.
max_output_tokensnamba a ɛnyɛ nanteɛ nambaDaabiNkyerɛkyerɛmu a ɛwɔ tokens mu paa kɛseɛ.
temperature
top_p
nɔbaDaabiSɛmmuae ntentan, ɛhe na mɔdeɛ no fa wɔn.
tools
tool_choice
parallel_tool_calls
array, string anaa object, booleanDaabiNnwuma nneɛma, wɔ Responses kɔntow mu ({"type": "function", "name": …, "parameters": …}). A web_search annaa web_search_preview ntoma no hyɛ aseɛ web nwosɛeɛ ɛberɛ a ɛboa. Afutuo a wɔahyɛ mu bi a wɔato n'anim.
reasoningadeɛDaabi{"effort": "minimal" | "low" | "medium" | "high"}. xhigh ne max kyerɛ high; none ɔtwa mu.
text.format
response_format
adeɛDaabiNtenteneɛ nsuaeɛ, sɛ JSON schema anaa json_object.
metadataadeɛDaabiƐnhyɛ biara wɔ mmuae no mu. Akɔnten mmiensa ansa na nnyigyeɛ (string) 16, nkyerɛkyerɛmu (keys) a ɛrekɔ so mmiensa ansa na nnyigyeɛ (values) a ɛrekɔ so mmiensa ansa na mmiensa ansa.
streambooleanDaabiMma nneɛma a wɔahwɛ aseɛ yi mmɔ bɔ ase sɛnea wɔasɛe no.
storebooleanDaabiYɛanyɛ ne sɛ wɔahyɛ no nka. Biribiara nni hɔ a wɔasiesie, na mmuae no koraa kyerɛ sɛ "store": false.
previous_response_id
conversation
background
string, object, booleanDaabiYɛntumi nkyerɛ: 400 unsupported_parameter. Abasobɔdeɛ no ntena hɔ, enti hyɛ wo nkitahodie no nyinaa mu ma input bere biara.

Aboa mu nkyerɛaseɛ

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

Nneɛma a wɔpɛ sɛ wɔde yɛ bi bue wɔ output te sɛ nea function_call nneɛma a ɛwɔ ne ho call_id, name ne arguments; hyɛ mmuae no ano sɛ a function_call_output adeɛ a ɛyɛ pɛ no call_id. Nkaeɛ, sɛ model no de ba a, yɛ... reasoning nneɛma a ɛwɔ ne ho reasoning_text nneɛma, a wɔahyɛ no ase tiên. status ɛyɛ incomplete Sɛ mmuaeɛ no baeɛ max_output_tokens anaa ɔkyerɛkyerɛfo no ampa, ne nea incomplete_details.reason hyɛ ase kɔ max_output_tokens annaa content_filter. Ɛde mbuase no nso kyerɛ asɛm a wɔapɛ no (temperature, tools, tool choice ne ne nso) sɛ OpenAI de yɛ no, na ɛhyɛ... nymbot nkwantuo adeɛ.

Wɔde aguu so, adeɛ biara a ɛkɔ so no yɛ event: nidi ne a data: nkɔnten ne baako sequence_number, wɔ saa order yi mu: response.created, response.in_progress, response.output_item.added, response.content_part.added, adeɛ nkontaa biara response.output_text.delta, response.output_text.done, response.content_part.done, response.output_item.done, na ɛtɔ mpoɔ response.completed ne using ne nnyigyeɛ no ho. Ɛbɛpɛ sɛ nkyerɛaseɛ no bue firi hɔ sɛ response.incomplete mmom, na nnyɛ akwan bi a ɛte sɛ sɛ stream no hyɛɛ aseɛ no akyi kɔɔ response.failed. Nkaeɛ nteɛm no wɔ ne nea ɛyɛ ne nea ɛhia ne ne nea ɛwɔ biako a ne ho hia ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako ne ne nea ɛwɔ biako response.reasoning_text.delta ne .done. Nnwuma nkyerɛkyerɛmu no ba mfitiaseɛ no akyi, nea biara ne adeɛ bi a ɛwɔ response.function_call_arguments.delta ne .done.

ƐdaeɛƐberɛ bɛn?
400Daabi model annaa input; previous_response_id, conversation, background annaa item_reference (unsupported_parameter); mmoatua nneɛma an asɛm daresi a wɔansi nidi.
402, 403, 404, 429, 502, 503Sɛ ɛfa Chat Completions ho a.

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 Nsɛmfua

Anthropic nhoma nkyerɛkyerɛmu no, ɛfa Anthropic SDKs ne Claude Code ho. Ɛyɛ adwuma wɔ model biara a ɛwɔ catalog no mu, ɛnyɛ Claude nkoaa: wɔkyerɛ asɛm no ase, ɛyɛ adwuma wɔ pipeline no mu, na ɛsan kyerɛ no ase bio.

POST https://nymbot.ai/api/v1/messages — hia API key, sɛ x-api-key annaa Authorization: Bearer.

The anthropic-version ne anthropic-beta headers no wɔn de ma na wɔannhyɛ mu. Anthropic model din no wɔde hyɛa katalog no mu, na sɛdei no maa Claude Code ne SDKs no yɛ adwuma wɔ din a wɔde nso wɔn mu:

  • Din bi a kɔtekɔ no nim, te sɛ claude-sonnet-5 annaa anthropic/claude-opus-5, yɛde no sɛnea ɛwɔ hɔ no ara.
  • Sɛ ɛnyɛ saa a, da (-20260514), -latest, version tag bi te sɛ -v1, nkyerɛkyerɛmu a wɔahyɛ mu te sɛ [1m] na anthropic/ annaa anthropic. prefix no wɔfi hɔ, na nkyerɛwee ne nkyerɛkyerɛmu a ɛwɔ asɛm no mu no wɔhwɛ biribiara a ɛbɛyɛ possible (claude-haiku-4-5 nneɛma a wɔahu no claude-haiku-4.5).
  • Sɛ ɛnyɛ biribiara nso nnye a, yɛde abusua no (Opus, Sonnet anaa Haiku) di dwuma, sɛ katalog no nkyerɛwee no yɛ saa anaa ɛwɔ hɔ kɔ anim sɛ wɔbɛpɛ no.
  • Din a ɛnyɛ hwee ho no, ɛba 404 not_found_error.
Akwantuo kwanTwerɛƐsɛ sɛ wɔde di dwumaNkyerɛkyerɛmu
modelntɛntɛnAaneKatalog model id, an Anthropic model din.
max_tokensnamba a ɛnyɛ nanteɛ nambaAaneNkyerɛkyerɛmu a ɛwɔ tokens mu paa kɛseɛ.
messagesarrayAaneuser ne assistant nkyɛn, ne ho text, image (base64 anaa URL ɛnyina), tool_use ne tool_result nkyɛnkyɛn. thinking Ebuo a ɛfiri ase nkyekyɛmu mu no, yɛgye wɔn na yɛtu wɔn.
systemstring anaa arrayDaabiSɛnea kyerɛkyerɛmu no kyerɛw, sɛ asɛm anaa ne nkyerɛkyerɛmu mfonini ne sɛ.
temperature
top_p
nɔbaDaabiSɛmmuae ntentan, ɛhe na mɔdeɛ no fa wɔn. top_k yɛsie na yɛgye.
stop_sequencesnkyerɛwee mfonini a ɛwɔ nkyerɛwee mu aduane dodoɔDaabiNsɛm a ɛsi mmuae no ase. Nsɛm atɔn atɔn biara, obiara nnyɛ nkyerɛkyerɛmu mmienu atɔn atɔn.
tools
tool_choice
array, nneɛma a wɔahyia mu, nneɛma a wɔahyɛ muDaabiNneɛma a ɛwɔ ne ho kɔ name, description ne input_schema. A web_search server nneɛma no hyɛ aseɛ web nwosɛeɛ; Anthropic nneɛma a wɔde hyɛ mu foforɔ biara (bash, text editor, computer use) no kyerɛ sɛ wɔahyɛ no akyi wɔ unsupported_tool. tool_choice fa auto, any, tool annaa none, na disable_parallel_tool_use.
thinkingadeɛDaabi{"type": "enabled", "budget_tokens": 8192}, {"type": "adaptive"} annaa {"type": "disabled"}. Sika a ɛwɔ hɔ no totow adwene mmienu: sɛ ɛnyɛ 2,048 a ɛyɛ ketewa, fi 2,048 no kɔ ketewa bi, fi 8,192 no kɔ kɛseɛ, fi 16,384 no kɔ kɛseɛ paa. Adaptive no de ne ho bɔɔ mmɔden output_config.effort, anaa ɛka.
streambooleanDaabiStream wɔ Anthropic event kɔntɛnt mu.
metadataadeɛDaabiYɛahyɛɛ no ase na yɛatow no nti.

Aboa mu nkyerɛaseɛ

{
  "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 ɛtumi kura nso tool_use nnuane ne a thinking akɛseɛ, abusɔɔdeɛ signature ɛda hɔ. stop_reason ɛyɛ end_turn, max_tokens, tool_use annaa refusal, yɛɛ no kwan a ɛyɛ pɛ te sɛ finish_reason ɔn Kasa Mu Nneɛma; stop_sequence ɛda mmerɛ biara mu null, sɛ stop sequence bi baa mu kɔɔ mmuaeɛ no no tia, ɛnso. input_tokens nkyɔkyɛ foforɔ nko ara; nneɛma a wɔayɛ nhwɛsoɔ wɔ cache mmienu no mu. Awiee no wɔ nymbot nneɛma ne ne no X-Nymbot-Cost-Sats ti.

Wɔatow no, nnwuma no yɛ Anthropic nka: message_start, content_block_start, ping, content_block_delta (text_delta, input_json_delta annaa thinking_delta), content_block_stop, message_delta ne n'akwahon nimdeɛ no, ne dwumadie ne ne nymbot sika mu dwumadi, ne nso message_stop. A ping ɛyɛ saa ara a wɔde hyɛ so tuma winna sa firi sa 15 seconds biara sɛ dwumadie no kɔ so. Atuo nnyinasoɔ no ba wɔ text no akyi, ɛda biara sɛ tool_use ɛkyekyɛmu no ne nea ɛda mu nyinaa wɔ baako mu input_json_delta.

Errorwɔ wɔ saa endpoint yi so no, Anthropic format no na wɔde di dwuma: {"type": "error", "error": {"type": "not_found_error", "message": "…"}}. A mfinim mpanin ye 402 billing_error, ɔdom a adwuma dɔɔsoɔ 503 overloaded_error. Nnyigyeɛ a ɛba wɔ stream no asi ansa no, wɔde bɔ no sɛ error asɛm.

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

Akonta token

An nkyerɛkyerɛmu sɛnea input tokens pii bɛtena Messages request bi mu, na client no ahu no ansa to sɛ ɔbɛhyɛ no. Ɛyɛ aduane anom, nanso ɛhia key bi.

POST https://nymbot.ai/api/v1/messages/count_tokens — API key tiafoɔ tia. Ma free.

Ɔdɔ yi te sɛ nea ɛwɔ ɛno ho no ara Nsɛmmsɛm, sɛnea Ɛnyɛ max_tokens; model din no nnye kwan. Nkontaa no yɛ mpaatopa: system prompt no nkyerɛwee, messenjɛ, tool calls ne tool definitions no nyinaa a wɔatua wɔ awe nneɛma nan mu, ne mmaako, ne mmaako 1,600 ɛde mfonini biara. Ɛnyɛ provider no nkyerɛwee kɔntaa kwan ne sɛ, ɛno nti nkontaa no bɛtumi asese. Akwan a ɛdwene sɛ ɛnwɛ nkwantuo mu no, ɛtumi kɔ so kɔdie.

Aboa mu nkyerɛaseɛ

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

Mmoa a wɔn wɔ list mu no

API no a ɔhyɛ saa model ne generator biara a ɔde ka, ne nea ɛdi ne boɔ. Wɔfrɛ list no firi catalog a ɛwɔ hɔ daa no, enti ɛyɛ nea server no bɛbɔ no daa.

GET https://nymbot.ai/api/v1/models — kɔkɔɔ biara nni hɔ a ɛhia. Wate mu ase mfeɛ nnan so.

GET /api/v1/models/{id} ɛtua baako na ɛde dua.

Akwantuo kwanTwerɛƐsɛ sɛ wɔde di dwumaNkyerɛkyerɛmu
typestring (asɛm asɛ:")Daabichat (nea ɛda hɔ no), image, video, audio, embedding annaa all. Adeɛ pii bɛtumi akyerɛw, sɛ image,video.

Nnɔdwuma ne deɛ wopae no, ɛwɔ fee ne margin no mu ananوام, wɔ dollas ne sats wɔ Bitcoin ntwereɛ a ɛwɔ nnɛ yi so no mu. balance kyerɛ sɛnea model no de ne nkyɛmu no di dwuma. nymbot_key Model no din a ɛyɛ ketewa no wɔ app no mu anaa? created ɛyɛ 0, ɛdi sɛ catalog no nni dwuma sɛnea model bi baeɛ no kyerɛɛ. Model a ɛnyɛ token rates a wɔapue no nti, wɔtɔ no din wɔ per_request sɛ anka.

nymbot/auto ɔda soɔmma, ɔdwene sɛ variable, ne bi 🏾 routes adeɛ a ɛkyerɛ kɔmɔ biara nhyira kɔmɔ biara adwuma kɔmɔ no, ɛkyerɛ nteaseɛ ne nteaseɛ nanso, ɛmfa nneɛma a wɔde di dwuma no nkyerɛ nnye.

GET /api/v1/models/{id} Wɔfa din ahorow ne din foforɔ a ɛyɛ pɛ pɛ ara so sɛnea mpaebɔ, na ɛde nnyigye ma model a ɛkyerɛ kwan no.

Aboa mu nkyerɛaseɛ

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

Afọpa a ɛda so no:

  • Sɛnkyerɛn wo nkyɛn nkyerɛkyerɛmuwɔ nkyerɛwɔ mu wɔ capabilities (accepts_image_url, requires_image_url, edit) na bi ɔsɔdeɛ per_generation.
  • Video nkyerɛkyerɛmuwɔ nkyerɛwɔ mu wɔ max_duration_seconds ne resolutions, ne adidiɔɔ per_second adeɛ biara a ɛfa resolution no ho.
  • Nne nkyerɛkyerɛmuwɔ nkyerɛwɔ mu wɔ audio_type speech annaa transcription, boɔ kɔɔsoɔ no per_1k_chars annaa per_minute.
  • Akwantu kwan nkyerɛkyerɛmuwɔ nkyerɛwɔ mu wɔ dimensions, context_length, max_inputs na nkyɛnkɛnsɛn kɔmɔ koro nka input tokens milionyomom amon.

Nnuadeɛ nnuadom a wɔahyɛ nhyehyɛeɛ mu "estimated": true adaka no nka nka mmoa a ɛfa generator a ne boɔ nnyɛ amanneɛ. Nea yɛnni aseɛ type nsuadeɛ 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);