Hla mus rau cov ntsiab lus
Rov mus rau Nymbot

Kev paub hauv paus Cov neeg tsim software

Kwv txhia, Cov Lus Teb thiab Cov Lus Nrog

Muaj peb txoj hauv kev nug ib lub model ib yam dab tsi, hauv peb lub peb c اضافీ peb txoj kev hais lus uas cov neeg siv khoom siv tam sim no, txhua yam run ntawm tib cov model thiab raug them nqi zoo ib yam.

Kev Teb Lus hauv Kev Sib Txuas Lus

Lub OpenAI chat format, thiab lub uas txhua yam cuab tam yuav tsum txhawb nqa. Coj cov lus tham uas tau tham mus txog xa mus thiab tau tau lub ntsiab lus tshiab rov qab los.

POST https://nymbot.ai/api/v1/chat/completions — xav tau ib lub API key.

Nrog tsuas yog model thiab messages yog li ntatej xav tau. Ib qho sampling parameter uas qhov model uas xaiv tsis siv yuav raug tshem tawm yam tsis muaj error, yog li ntawv thov (request body) ib yam xwb yuav siv tau rau txhua hom model. Daim ntawv qhia cov model yuav qhia txhua qhov model li supported_parametersQhov uas raug tsis lees txais rau ntawm qhov uas raug tso tseg yog txhua yam uas lub model tsis ua tau li: cov duab rau ib lub model uas tsis pom tau, thiab cov cuab yeej rau ib lub model uas tsis paub hu lawv los siv.

NtawvSauIb yam xav tauDaim Ntawv Qhia
modelximYog lawmnymbot/auto (los yog auto) rau Nymbot txoj kev coj mus ntawm qauv balance, los yog ib lub catalog model id xws li anthropic/claude-sonnet-5 rau Pro balance. Cov npe luv thiab cov alias ntawm lub app kuj raug lees thiab. Yuav qhia tau rau kawg ntawm lwm thaj tsam. tus kab ntxiv rau tom qab lo lus.
messageskev teemYog lawmKev sib tham. Cov luag haujlwm. system, developer (raug khoj thiab kho) user, assistant thiab tool. Ntawv yog ib kab lus lossis ib daim ntawv ntawm text thiab image_url cov feem; duab xwb nyob hauv cov neeg siv cov lus. input_audio thiab cov ntaub ntawv qee feem raug tsis txais.
streambooleanTsis yogXa cov lus teb raws li nws sau los. Saib kev nrog kev xa ntawv ntawm internet.
stream_optionsyamTsis yog{"include_usage": true} ntxiv ib feem kawg uas muaj cov kev ntsuas token thiab tus nqi.
max_tokens
max_completion_tokens
tus lej txhua ntuTsis yogNtau tshaj plaws cov tokens uas yuav sau tau. Yog dhau qhov tswj hwm ntawm lub model, nws yuav hloov mus rau qhov siab tshaj plaws. Nws tseem teeb xws li yuav muab ntau npaum li cas ntawm koj cov nyiaj, yog li tus lej me yuav xav tau nyiaj tsawg dua thaum pib.
temperature
top_p
tus lejTsis yogKev tswj fwm kev tshuaj xyuas cov ntaub ntawv: temperature ntawm 0 mus rau 2, top_p los ntawm 0 mus rau 1.
stopkab ntawv lossis arrayTsis yogNqe lus uas kaw qhov teb: ib tsiaj ntawv lossis ntau tshaj plaws 4 tsiaj ntawv, txhua tsiaj ntawv tsis tshaj 256 tus cim. Tsis siv los ntawm nymbot/auto.
seedtus lej txhua ntuTsis yogRau kev tsim cov kev nthuav dav uas tsis hloov pauv, qhov uas lub model txhawb nqa nws.
presence_penalty
frequency_penalty
tus lejTsis yogCov tswj fwm kev rov qab los, txhua lub ntawm -2 mus rau 2.
response_formatyamTsis yog{"type": "json_object"} los yog {"type": "json_schema", "json_schema": {…}}, qhov uas lub model txhawb nws. Tsis yog siv los ntawm nymbot/auto.
tools
tool_choice
parallel_tool_calls
array, kab ntawv, lossis inbox, qauv tiag, booleanTsis yogHu tswv yim. Saib kev hu cov cuab yeej. A web_search lub cuab yeej tsim dheev tshaib tuaj nrhiav hauv vebสูงสุด 128 cov cuab koj thiab 512 KB ntawm cov ntsiab lus, ntxiv ua haujlwm tsis tshaj 64 qib tob; ntau tshaj nws yog qhia qhia qhov tsis tsim nyog 400.
reasoning_effort
reasoning
no lus, thawj yam nrog rau tshuab nrog rau nqiTsis yog"minimal", "low", "medium" los yog "high", los yog {"effort": "high"}. "none" los yog {"enabled": false} tau tsum nws. Saib kev xav tswv yim.
pluginskev teemTsis yog[{"id": "web", "max_results": 5}] เสมอ lwm ntej nrhiav hauv lub vev xaib. Mus txog 10 cov txiaj ntsim.
ntus lej txhua ntuTsis yogTsuas yog 1. Yam tshiab ntxiv txhua yam yuav rov qab los 400.
logit_bias
user
metadata
yam, kab lus, yamTsis yogTau txais lawm tab sis tsis tau xa mus ntxiv. logit_bias xim tau txhua txhua 300 token ids mus rau cov lej ntawm -100 mus rau 100; user yog li tsis tshaj 256 cov cim; metadata muaj ntau tshaj plaws 16 ntawm cov string values, cov keys mus txog 64 tus tsab ntawv thiab cov values mus txog 512.

Lub teb yog ib yam tsis tshia tshwjເພeeb chat.completion, nrog tus nqi hauv usage.cost (hauv dollar) thiab hauv nymbot khoom. model yog tus resolved model id, thiaj li yog ib lub npe luv thiaj li rov qab los ua ib lub npe tiav. Yog tias lub model tau xav ua ntej yuav teb, nws txoj kev xav nyob hauv message.reasoning_content, tsis sib txuas ntawm cov lus teb.

Teb lus

{
  "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 yog raug tshuaj xyuas los ntawm qhov uas tau rov qab los, vim cov neeg muab kev pab cuam qhia nws tsawg txawv: tool_calls Thaum tus model thov cov cuab tam, length thaum cov lus teb siv tag nrho cov lus uas tau pub (los yog tus qauv siv tag nrho rau kev xav thiab tsis tau sau lus teb), content_filter thaum tus neeg muab kev pab tsis kam, thiab stop yog tsis yog li ntawd. usage.completion_tokens_details.reasoning_tokens yog li 0: tsis tshua pom cov reasoning tokens raug suav, thiab them, nyob rau hauv completion_tokens.

Qhov xwm txheejThaum twg
400Tsis yog model los yog messages (missing_required_parameter); ib feem suab lossis ib feem ntawm daim file, lossis cov duab rau ib lub model uas tsis pom lawv (unsupported_content); tshaj 20 daim duab (too_many_images); ib lub sampling parameter yog hom tsis yog los yog tsis raug qhov qib (invalid_value); ib daim duab link uas tsis yog zej kaum (invalid_image_url); cov cuab yeej rau ib qho model uas tsis tuaj yeem hu lawv (unsupported_tool); n ntawm 1; a :thinking lub npe ntxiv tom qab rau ib lub qauv uas tsis muaj peev xwm xav tau (model_not_found); los yog tus neeg muab tsis lees txais qhov kev thov (upstream_rejected).
402Qhov nyiaj uas lub model siv tsis txaus rau qhov uas yuav tsum tseg.
403Qhov tsis zoo tshaj plaws tsis haum rau lub npe ntawm lub qhov (key_limit_reached). Thaum qis dua max_tokens los yog nce lub thaj kaum.
404Tsis muaj qauv (model) uas muaj lub npe ntawd (model_not_found).
429Lub qhov txwv ntawm kev thov ntawm tus key, lossis ntawm tus neeg muab (upstream_rate_limited).
502, 503Lub neeg muab kev pab tsis ua tau (upstream_error) los yog ntau dhau (upstream_overloaded, nrog Retry-After). Tsis muaj dab tsi raug them nqi med rau tsis yog tus neeg muab kev pab tau xa ntawv thiv nqi rau qhov kev sim ntawd.

Cov status code uas txhua endpoint siv yog raug faib hauv yuav ua yuav tsis zoo.

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

Kev ua dej nrog online

Nrog "stream": true cov lus teb tuaj los ntawm server-sent events thaum qhov model sau ua nws. Txhua lub event yog ib chat.completion.chunk nqi ntawm ib data: kab, thiab qhov ntais kawg yog data: [DONE]. Kev xav tswv yim tuaj los ntawm delta.reasoning_content, tus teb lus nyob rau hauv delta.content.

Xa tes li yam dab tsi uas yuav siv tshaj li 100 vib ntxuav, xws li lus teb ntev, ib yam loj max_tokens los yog ib qho reasoning model. Ib qho thov uas tsis yog streamed yuav tsis xa dab tsi mus txog thaum lub teb lug tiav, thiab network ntawm koj thiab Nymbot yuav kaw ib lub connection uas tsis muaj kev siv tom qab li 100 seconds; lub model tseem yuav ua tiav thiab qhov nws sau tau yuav raug them nyiaj, tab sis lub teb lug yuav poob. Ib qho stream yuav xa keep-alives, yog li ntawd nws yuav nyob qhib mus rau txhua lub sij hawm uas lub model sau.

Me dej

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]
  • Cov kab uas pib nrog : cov yog cov lus thanj (keep-alive comments), uas raug xa txhua txhua 15 feeb rau thaum lub model tab tom xav. Cov SSE clients tsis xav tau lawv.
  • Nug yog "stream_options": {"include_usage": true} ua kom tau lub me me kawg saum toj no, thiab nrog ib yam khoob tsis muaj dab tsi choices, cov token ntau npaum, tus nqi thiab qhov nymbot khoom.
  • Qhov nqi yuav raug them tom qab qhov kev xa ntawv (stream) tawm tag. Yog tias koj kaw kev txuas ntxiv yav ntxov, tus qauv (model) tsis raug tsum: Nymbot yuav nyeem qhov tshuam ntxiv ntawm tus neeg muab cov ntawv (provider), mus txog li 25 vib nas thim, txhawm rau ua rau paub nws cov lus (token count), thiab koj yuav them raws li tus neeg muab cov ntawv qhia. Yog tsis muaj qhov kev suav ntawd, qhov nqi yuav raug kos tseg los ntawm koj cov lus thiab qhov uas tau sau, ntxiv rau tag nrho qhov kev pub zoo ntxiv rau ib hom qauv uas muaj peev xwm xav tau (reasons).
  • Ib qho xwm txheej uas yuav tshwm sim ua ntej thawj pob, xws li 401 los yog 402, rov qab los ua JSON zoo li qub nrog nws cov status code, tsis yog ib yam uas tsis tu ncua (stream). Ib yam kev yuam (error) tom qab qhov uas tsis tu ncua tau pib tsog los ua qhov kawg data: {"error": {…}} lub teeb meem, thiab qhov kev nrog mus tsis tiav yam tsis muaj [DONE].
  • Cov kev thov nrog cov cuab yeej, thiab cov model ntawm OpenAI's Responses transport, tsis yog cov uas yuav thauj mus rau ntawm lub provider. Lawv tseem teb nrog ib daim stream uas yog raug, uas yuav raug xa thaum cov lus teb tiav tag.

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

Hu cov cuab yeej

Qhia txog cov haujlwm hauv tools thiab qauv tuaj yeem thov kom muaj ib yam raws li hu tsis yog raug teb. Koj khiav lub function, ntxiv nws txais qhov tshwm sim ua ib tool lus nrog qhov zoo nrog[/thought] tool_call_id, thiab xa cov lus sib tham ntawd rov qab los. Nymbot tsis tau khiav koj cov haujlwm li; nws xa cov thov ntawm tus model rov qab rau koj.

tool_choice txeeb "auto", "none", "required" los yog {"type": "function", "function": {"name": "…"}}Lub npe ntawm cov model yog qhia tias cov model twg tuaj yeem hu tau cov cuab yeej (capabilities.tools). Cov cuab yeej yog tsiv tsis tau nrog 400 unsupported_tool tau meej nymbot/auto thiab rau cov catalog models luv luv uas khiav ntawm OpenAI's Responses transport, uas Nymbot tsis tuaj yeem xa tools mus rau.

Nrog "stream": true, ib q lo lus thov nrog cov cuab yeej khiav ua ib daim nyob zoo thiab tom qab ntawd raug xa mus ua ib lub chuav ntau (chunk sequence) li qub: lub luag haujlwm (role), ib lub chuav uas muaj txhua yam tool call nrog nws tus index, id, npe thiab cov lus qhia (arguments), thiab lub finish chunk. Cov chaw txais (clients) uas nyeem cov streamed tool calls yuav ua nws li qub.

Teb, ib feem

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

Cov duab hauv ib qho kev thov

Nrog cov qauv capabilities.vision nyeem tau cov duab. Ntxiv ib cái image_url feem ntawm ib tus neeg xa lus, nrog rau ib qho tshiab tshwj xeeb lossis tsis tshwj xeeb https:// txuas lossis tshuam data:image/…;base64, URL. Txog 20 daim duab rau txhua qhov kev thov. Cov duab SVG yuav tsis lees txais, thiab tsis lees txais cov link uas ntev tshaj 4,096 tus ntawv lossis ib lub link uas muaj lub npe neeg siv lossis tus ntawv zais cia nyob rau hauv (400 invalid_image_url). Ib qho uas tsis tsim txhais detail yog auto, low los yog high.

Nrog nymbot/auto, ib thov nug uas muaj daim duab rau rau ib qho qauv ntawm model uas pom tau. Ib qho catalog model uas tsis muaj capabilities.vision tsiv tsis lees yuav cov duab nrog 400 unsupported_content. Cov duab tsuas muaj nyob rau hauv cov neeg siv lus xwb. Ib lub link yuav tsum tawm mus rau ib qhov chaw tso duab pej xeem; Nymbot tsuas xa cov duab mus rau tus neeg muab qauv model thiab tsis khaws cia nws.

Ib daim duab yuav raug them nqi raws li cov input tokens uas tus neeg muab kev pab tshuaj xam rau nws, ib yam li cov kev thov lwm yam.

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

Kev tswv yim

Nrog cov qauv capabilities.reasoning tuaj yeem xav ua ntej lawv teb. Nrhiav ntau ntxiv los yog tsawg zog nrog nws reasoning_effort ("minimal", "low", "medium" los yog "high") loss "reasoning": {"effort": "high"}, loss yog ntxiv :thinking rau lub npe ntawm qauv, uas txhais tau tias muaj kev siv zog siab. Ntawm ib qho qauv uas tsis muaj kev xav (reasoning), qhov kev teeb tsa yuav raug tsis saib xés. Nrog rau nymbot/auto, :thinking xa cov lus thov mus rau ntawm txoj kev xav tshuaj xyuas uas tsis tshua hloov pauv.

Ntawm cov Anthropic models, kev siv zog yuav dhau los ua ib lub nqi xav ua npaum li 1,000, 2,000, 8,000 lossis 16,000 tokens, tsis tshua ntau tshaj li ntawd max_tokens tso cai. Kev xav raug tso tseg thaum tool_choice tsim kom siv ib lub cuab yim, thiab thaum thov kev mus ntxiv ua ib qho kev rov qab ntawm cov cuab yim ( nws lub lus kawg yog ib qho tshwm sim ntawm cov cuab yim), vim tias Anthropic yuav tsum tau cov kev xav uas muaj kev tso tim ntawm yav dhau los thiaj li tuaj yeem tsis tseg tau. Ib yam nkaus li ntawd kuj yog rau Responses thiab Messages endpoints.

Kev xav rov los hauv message.reasoning_content, los yog delta.reasoning_content thaum ua streaming, tsis txhob muab ntxiv rau hauv cov lus teb. Kev xav txog yog output thiab raug them raws li ntawd, nyob hauv completion_tokensQee tus neeg muab kev pab tsis xa cov ntawv piav qhia rov qab li, tab sis tseem raug them nqi.

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

Cov npe ntxiv ntawm qauv

Ib lub npe ntxiv ntawm qhov model npe yuav hloov kev ua haujlwm ntawm qhov thov, tsis tas siv lwm lub field ntxiv. Lawv ua haujlwm rau tag nrho cov id thiab luv npe ib yam nkaus, xws li anthropic/claude-sonnet-5:online.

Ntsiab lus tom qabKuv txhais lus
:onlineNrhiav hauv internet ua ntej, zoo li plugins: [{"id": "web"}]. Saib nrhiav hauv veb.
:thinkingKev xav siab heev; tsim nymbot/auto, txoj kev xav tswv yim. Ntawm ib lub model uas tsis tuaj yeem xav tswv yim, 400 model_not_found thiab “tsis pom cov qhov chaw kawm tiav”.
:nitro, :floor, :exacto, :extendedTxiv tsis tau thiab tsis tau saib xign. Txhua catalog model muaj ib txoj kev (route), yog li tsis muaj txoj kev uas nrawm dua, pheej huv dua, lossis ntev dua los xaiv; cov suffixes tso cai rau cov model names uas muab copy los ntawm lwm lub services tseem ua hauj lwm tau.

Txhua qhov ntxiv ntxiv (suffix) lwm yam yuav raug tsis tshuaj xyuas. Lub npe tag nrho yuav raug sim ua thawj, yog li ib qho model uas nws id muaj cov ntxim ceeb (colon) tseem yuav ua tau; yog tsis ua tau, cov ntxiv ntxiv yuav raug tshem tawm ntawm tom qab ib qho ib qho kom txog thaum ib qho model sib haum; Lub npe model tuaj yeem muaj ntev tshaj 200 characters nrog rau muaj tsis tshua ntawm 4 suffixes; yog ntev tshaj li ntawd yuav raug tsis lees yuav nrog 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);

Txhua yam chat model tuaj yeem teb los ntawm lub vev xaib uas tab tom ua haujlwm. Nymbot nrhiav cov lus uas tus neeg siv tau sau kawg tshaj plaws (lub 2,000 characters ntawm nws) tuaj nyeem cov vaj ngoog zoo tshaj plaws thiab muab rau lub model nrog rau qhov lus nug, uas raug faib ua cov ntaub ntawv sab nraud uas lub model tsis txhob ua raws li cov lus qhia rau. Muaj ob yam kev ua:

  • Nrog txhua lub sijhawm nrhiav: "plugins": [{"id": "web", "max_results": 5}], los yog ib :online cov ntxiv ntawm qauv.
  • Nrhiav thaum nws pab tau: "tools": [{"type": "web_search", "parameters": {"max_results": 5}}], thiab lees yog tso cai ua web_search_preview los yog openrouter:web_search. Nymbot nrhiav xwb thaum nug zoo nkaus li xav tau cov ntaub ntawv tshiab tam sim no, ib yam nkaus li qhov uas lub app siv.

max_results yog 5 raws li qub thiab tsis tshua ntawm 10. Cov chaw tuaj ntawm cov ntaub ntawv yog rov qab los hauv nymbot.web_search.sources, txhua tus muaj ib tug title, snippet thiab url, thiab raws li url_citation cov lus piav qhia rau lub xov xwm.

Txhua qhov kev nrhiav uas khiav yuav nqi $0.008, hloov mus ua sats, ntxiv rau cov tokens, thiab nws yog ib feem ntawm kev tuav. Cov nplooj ntawv uas nws nyeem los yog input tokens thiab, yog li ntawd ib lo lus teb los ntawm lub vev xaib yuav nqi ntau dua ib lo lus nug tib yam nkaus uas nug tsis muaj kev nrhiav, qee zaum ntau tshaj plaws.

Teb, ib feem

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

API Kev Teb

OpenAI lub tswv yim tshiab, uas OpenAI Agents SDK thiab Codex siv. Nws khiav ntawm cov model, nqi them, thiab cov yam ntxwv ib yam nkaus li Chat Completions.

POST https://nymbot.ai/api/v1/responses — xav tau ib lub API key.

NtawvSauIb yam xav tauDaim Ntawv Qhia
modelximYog lawmTxog rau Kev Teb Lus hauv Kev Sib Txuas Lus, suav nrog cov lus thaum kawm.
inputkab ntawv lossis arrayYog lawmIb kab lus, lossis ib tsev ntawm cov yam ntxwv: messages (roles user, assistant, system, developer) nrog input_text, input_image thiab output_text cov xwm, thiab function_call thiab function_call_output cov khoom siv rau cov cuab yeej. input_image coj ib image_url link los yog data URL, tsis yog ib lub file id. reasoning thiab web_search_call cov khoom raug dhau tsis tau; item_reference tau txwv.
instructionsximTsis yogCov lus tswj hwm lub neej system.
max_output_tokenstus lej txhua ntuTsis yogNtau cov tokens tshaj plaws los sau.
temperature
top_p
tus lejTsis yogKev tswj kev txhiaiv, qhov uas qauv yuav muab lawv mus.
tools
tool_choice
parallel_tool_calls
array, kab ntawv, lossis inbox, qauv tiag, booleanTsis yogCov cuab yeej ua hauj lwm, nyob rau hauv cov Responses duab ({"type": "function", "name": …, "parameters": …}). A web_search los yog web_search_preview lub cuab yeej tsim dheev tshaib tuaj nrhiav hauv veb thaum nws pab tau. Lwm cov cuab kev uas muaj tseg tsis tau txais.
reasoningyamTsis yog{"effort": "minimal" | "low" | "medium" | "high"}. xhigh thiab max txhais lus high; none tseem tshem nws mus.
text.format
response_format
yamTsis yogKhoom tawm ntawm cov ntaub ntawv uas raug tswj hwm, xws li ib JSON schema lossis json_object.
metadatayamTsis yogNug tsis hloov pauv hauv cov lus teb. Ntau tshaj plaws yog 16 nqe lus, cov npe (keys) txog 64 tshoob (characters) thiab cov ntsiab lus (values) txog 512.
streambooleanTsis yogXa cov xwm txheej raws li qhia qab qab no.
storebooleanTsis yogTsis tau saib xees. Tsis muaj dab tsi raug khaws cia, thiab cov lus teb tsis hloov li 🔍 "store": false.
previous_response_id
conversation
background
kab ntawv, yam, qhov tseeb/tsis tseebTsis yogTsis txhawj tau: 400 unsupported_parameter. Cov lus teb tsis raug khaws cia, yog li thov xa tag nrho cov lus sib tham rau hauv input tsis hais txhua zaum.

Teb lus

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

Ib qhov thov cov cuab tam tshwm sim nyob hauv output ua ib tug function_call khoom nrog call_id, name thiab arguments; xa cov tshwm sim rov qab los ua ib qho a function_call_output khoom nrog yam zoo nkaus call_id. Kev xav, thaum lub model tso tawm nws, yog ib reasoning khoom nrog reasoning_text nội dung, tsab luv thawj. status yog incomplete Thaum lub lus teb tsuam max_output_tokens los yog tus neeg muab kev pab tsis kam, nrog incomplete_details.reason teem rau max_output_tokens los yog content_filter. Lub teb lus los kuj qhia rov qab cov kev teeb tsa ntawm qhov thov (kub npaum, cov cuab yeej, kev xaiv cuab yeej, thiab lwm yam) ib yam li OpenAI ua, thiab nqa cov nymbot tus nqi lub nqi.

Nug thauj, txhua qhov xwm txheej yog ib qho event: ntug thiab a data: kab nrog ib daim a sequence_number, raws li qhov kev mus no: response.created, response.in_progress, response.output_item.added, response.content_part.added, txhua yam tus nqi ntawm response.output_text.delta, response.output_text.done, response.content_part.done, response.output_item.done, thiab kawg ntawm no response.completed nrog rau kev siv thiab nqi. Ib zaj lus uas txiav txim tsis tiav yuav kawg nrog response.incomplete thay tsis yog, thiab ib qho kev tsis ua tau tom qab qhov stream pib nrog response.failed. Kev xav taug raws li nws yog lub ntsiab lus ntawm nws tus kheej nrog response.reasoning_text.delta thiab .done. Cov cuab yeej hu tuaj tom qab cov lus, txhua yam yog ib hom nrog response.function_call_arguments.delta thiab .done.

Qhov xwm txheejThaum twg
400Tsis yog model los yog input; previous_response_id, conversation, background los yog item_reference (unsupported_parameter); ib hom cuab yeej lossis hom ntsiab lus uas tsis txhawj tau.
402, 403, 404, 429, 502, 503Txog 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 Cov Teeb Txheej

Anthropic lub tswv yim, rau Anthropic SDKs thiab Claude Code. Nws ua hauj lwm tau nrog txhua lub model hauv lub catalog, tsis yog Claude xwb: cov lus thov yog raug txhais, mus dhau ntawm tib lub pipeline, thiab raug txhais rov qab.

POST https://nymbot.ai/api/v1/messages — xav tau ib lub API key, vim tias x-api-key los yog Authorization: Bearer.

Ntawd anthropic-version thiab anthropic-beta cov headers raug txais mus thiab tsis raug siv. Cov npe ntawm Anthropic models raug pauj mus rau lub catalog, yog li ntawd Claude Code thiab cov SDKs ua hauj lwm nrog cov npe uas lawv siv lawm:

  • Ib lub npe uas catalog paub, xws li claude-sonnet-5 los yog anthropic/claude-opus-5, yog siv li qub.
  • Yog tias tsis yog ib lub hnub (-20260514), -latest, ib daim tag version xws yog -v1, ib lub tag uas muaj bracket xws li [1m] thiab ib anthropic/ los yog anthropic. cov prefix raug tshem tawm, thiab cov dot thiab cov dash hauv version raug sim ob sab npaum (claude-haiku-4-5 pom claude-haiku-4.5).
  • Yog tias qhov ntawd tseem tsis tau haum rau dab tsi, tsev neeg (Opus, Sonnet lossis Haiku) yuav raug siv, tsuas yog lub version ntawm catalog zoo nkaus lossis tshiab dua lub uas raug nug xwb.
  • Ib lub npe uas tsis haum dab tsi los ntawm qhov tshwm sim 404 not_found_error.
NtawvSauIb yam xav tauDaim Ntawv Qhia
modelximYog lawmIb qho catalog model id, lossis ib lub Anthropic model npe.
max_tokenstus lej txhua ntuYog lawmNtau cov tokens tshaj plaws los sau.
messageskev teemYog lawmuser thiab assistant los, nrog text, image (base64 los yog URL chaw muaj), tool_use thiab tool_result blocks. thinking cov nqe lus ntawm cov kwv tij dhau los yog raug txais thiab tso tseg.
systemkab ntawv lossis arrayTsis yogLus qhia system, ua ib daim string lossis cov text blocks.
temperature
top_p
tus lejTsis yogKev tswj kev txhiaiv, qhov uas qauv yuav muab lawv mus. top_k tau txais thiab tso tseg.
stop_sequenceskeeb kwm ntawm cov kab lusTsis yogNqe lus uas xaus cov lus teb. Ib qis 4 kab lus, txhua kab lus tsis tshaj 256 tus ntawv.
tools
tool_choice
kev sib sau, tus yamTsis yogCov cuab yeej nrog rau name, description thiab input_schema. A web_search lub cuav ntim khoom pib ua hauj lwm nrhiav hauv veb; Anthropic lwm cov cuab yeej uas muaj nrog rau (bash, text editor, computer use) raug tsis tso cai nrog unsupported_tool. tool_choice txeeb auto, any, tool los yog none, thiab disable_parallel_tool_use.
thinkingyamTsis yog{"type": "enabled", "budget_tokens": 8192}, {"type": "adaptive"} los yog {"type": "disabled"}. Lub nqi siv xaiv ib qho qib zog: qis ntawm 2,048 yog qis tshaj plaws, ntawm 2,048 yog qis, ntawm 8,192 yog nruab nrab, ntawm 16,384 yog siab. Kev hloov pauv siv output_config.effort, los yog siab.
streambooleanTsis yogRau ntawm Anthropic's event format.
metadatayamTsis yogTxog thiab tsis tshwm sim.

Teb lus

{
  "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 tuaj yeem tuav tau thiab tool_use cov ntoo thiab a thinking pob, yog leej twg li signature yeej khoom tsis muaj. stop_reason yog end_turn, max_tokens, tool_use los yog refusal, ua tau zoo li finish_reason tau meej Kev Teb Lus hauv Kev Sib Txuas Lus; stop_sequence yog tas li null, txawm tias thaum ib qho tshuav kawg xaus lub lus teb xov los xij. input_tokens nqi input tshiab xwb; cov input uas tseg cia lawm nyob rau hauv ob lub cache fields. Nqi yog nyob rau hauv nymbot lub thawj thiab tus X-Nymbot-Cost-Sats lub npe saum toj

Nug nrog rau kev xa tawm, cov xwm txheej yog Anthropic cov: message_start, content_block_start, ping, content_block_delta (text_delta, input_json_delta los yog thinking_delta), content_block_stop, message_delta thiab qhov vim tsum, qhov kev siv thiab tus nymbot lub nqi rau yam uas muaj nqi, thiab message_stop. A ping yog tsis yog yuav raug xa txhua tsib xeeg rau ib zaug thaum lub model tab tom ua hauj lwm. Cov tool calls yuav tuaj tom qab cov ntawv, txhua yam yog ib tool_use tshuab txhua yam cov ntaub ntawv rau hauv ib yam nkaus input_json_delta.

Cov qhov xwm txheej yuam kev ntawm endpoint no siv Anthropic cov format: {"type": "error", "error": {"type": "not_found_error", "message": "…"}}. Ib lub nqi tshuav me yog 402 billing_error, ib tus neeg muab kev pab uas tsis txaus lub luag haujlwm 503 overloaded_error. Kev ua tsis tau tom qab qhov stream tau pib yog xa mus ua ib error kev tshwm sim.

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

Ntsuas cov token

Kev xam ntxhias txog seb ib thov Messages yuav siv input tokens npaum li cas, kom tus neeg siv tau tshawb xyuas ua ntej nws xa tawm. Nws yog dawb, tab sis tseem xav tau ib daim key.

POST https://nymbot.ai/api/v1/messages/count_tokens — xav tau ib lub API key. Dawb.

Lub cev zoo nkaus li rau Nqe lus, tsis muaj max_tokens; lub npe ntawm qauv (model name) yuav tsum tau pom tseeb. Lub xyov (count) yog ib qho kev kwv yees: cov ntawv ntawm system prompt, messages, tool calls thiab tool definitions faib rau peb, ntxiv rau 1,600 rau txhua daim duab. Nws tsis yog tus tokenizer ntawm tus neeg muab (provider), yog li ntawd tus xyov tiag thiaj li yuav txawv. Ib lub chaw (key) uas tau txog nws lub qib siab tshaj plaws tab sis tseem siv tau.

Teb lus

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

Ntau cov qauv

Txhua lub model thiab generator uas API txais yuav, nrog rau tus nqi uas nws yuav raug them. Daim ntawv no yog nyeem los ntawm catalog uas tseem siv tam sim ib yam nrog lub app txoj kev xaiv, yog li ntawd nws yog qhov uas lub server yuav khiav tas li.

GET https://nymbot.ai/api/v1/models — tsis xav siv chaw teb. Khaws cia rau tsib feeb.

GET /api/v1/models/{id} tso tawm ib qhov.

NtawvSauIb yam xav tauDaim Ntawv Qhia
typentais (kev nug)Tsis yogchat (lub tswv yim pib), image, video, audio, embedding los yog all. Muaj qee yam uas yuav tsum muab, ib yam li image,video.

Nqi yog qhov koj them, uas muaj nqi tiv thaiv thiab margin ntxiv lawm, nyob rau hauv lub ntiaj teb ntawm dollar thiab sats ntawm lub Bitcoin nqi tam sim no. balance hais tias yog hom hloov pauv nyiaj peev xeev twg uas lub model siv. nymbot_key lub npe luv ntawm qauv nyob hauv lub app. created yog 0 tas li, vim tias catalog tsis sau tias ib lub model raug ntxiv ntxiv thaum twg. Ib lub model uas tsis muaj cov nqi token uas tso tawm rau neeg pom yuav muaj nqi yog per_request xwb.

nymbot/auto yog ib yam uas ib txwm nyob ntawm ntawm thawj, raws li tus nqi yog variable, nrog ib tug routes lus qhia txhua txoj kev mus ntawm cov nqi. Nws qhia txog kev pom thiab kev xav, tab sis tsis qhia txog cov cuab yeej.

GET /api/v1/models/{id} txais yuav cov npe thiab cov luv npe zoo li ib qho kev thov, thiab rov qab cov ntaub ntawv rau lub model uas lawv taw qhia mus.

Teb lus

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

Lwm cov hom:

  • Duab cov npe tseg muaj capabilities (accepts_image_url, requires_image_url, edit) thiab ib tug tus nqi per_generation.
  • Video cov npe tseg muaj max_duration_seconds thiab resolutions, thiab ib tus nqi per_second rau txhua qhov kev daws teeb meem.
  • Suab cov npe tseg muaj audio_type speech los yog transcription, tus nqi per_1k_chars los yog per_minute.
  • Ntaus cov npe tseg muaj dimensions, context_length, max_inputs thiab ib tus nqi rau ib lab input tokens.

Nqi tau sau "estimated": true yog cov app's cov kev kwv yees xig rau ib lub tshuab tsim hluav taws xob uas nws tus nqi tsis tau tshaj tawm. Ib yam uas tsis paub. type kev rov qab los 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);