Rekọja si akoonu
Ti o ba tẹsiwaju ni Nymbot

Ipilẹ imo onibara

Chat, Awọn ifiranṣẹ ati Awọn ifiranṣẹ

Ọpọlọpọ awọn ọna lati fẹ a awoṣe ohun kan, ni awọn ọpọlọpọ awọn fọto ti awọn onibara ti o ba fẹ, gbogbo ṣiṣẹ lori awọn wọnyi awoṣe ati gbọdọ awọn ọna kanna.

Gbogbo awọn chat

Awọn OpenAI chat iroyin, ati ọkan nipa gẹgẹbi gbogbo awọn ọpa ni ipamọ. Fi awọn ibaraẹnisọrọ siwaju ki o si gba awọn ọrọ miiran.

POST https://nymbot.ai/api/v1/chat/completions — O nilo a API key.

Wọn model ati messages Ti o ba tẹsiwaju awọn iṣeduro iṣeduro ti awọn awoṣe ti a nilo ko ba wa ni ko ni eroja, ki o si ọkan iṣeduro iṣeduro ṣiṣẹ lori awọn awoṣe. supported_parametersTi o ba ti wa ni tẹsiwaju ki o si tẹsiwaju jẹ ohun ti awọn awoṣe ko le ṣe ni gbogbo: awọn aworan fun a awoṣe ti ko le ri, awọn ọpa fun a awoṣe ti ko le gba wọn.

Orilẹ-edeÀwọn ẹkaWọleỌrọìwòye
modelọrọìwòyeBẹẹninymbot/auto (Awọn auto) fun awọn Nymbot routing lori awọn oṣuwọn oṣuwọn, tabi a catalogu model id bi: anthropic/claude-sonnet-5 oju-iwe-iwe-iwe-iwe-iwe-iwe-iwe-iwe-iwe-iwe-iwe-iwe-iwe-iwe-iwe-iwe-iwe-iwe-iwe-iwe-iwe awọn ọja.
messagesOṣuwọnBẹẹniAwọn ifiranṣẹ. Awọn ifiranṣẹ system, developer (Tẹle bi awọn eto), user, assistant ati toolContent jẹ a string tabi ọrọìwòye text ati image_url awọn ẹya ara; awọn aworan nikan ninu awọn olumulo. input_audio awọn faili awọn ẹya ara ti wa ni rejected.
streamọrọìwòyemiiranṢayẹwo awọn ibeere bi o ti wa ni tẹlẹ. Wo akojọ.
stream_optionsObirinmiiran{"include_usage": true} Ti o ba tẹsiwaju awọn aṣa ti o ba tẹsiwaju awọn aṣa ati awọn aṣa.
max_tokens
max_completion_tokens
OṣuwọnmiiranỌpọlọpọ awọn tokens lati fi sori ẹrọ. Tẹle si awọn awoṣe ti o pọju ti o ba ni oke. Tun sori ẹrọ bi o ni owo ti wa lati wa lati rẹ owo, ki o kan kekere nọmba gbọdọ diẹ gbọdọ lati bẹrẹ.
temperature
top_p
nọmbamiiranIṣakoso iṣakoso: temperature lati 0 si 2, top_p Nipa 0 si 1.
stopỌrọigbaniwọle ArraymiiranTẹle ti o pọju awọn ifiranṣẹ: kan string tabi ko siwaju sii ju 4 string, kọọkan ni ko siwaju sii ju 256 characters. nymbot/auto.
seedOṣuwọnmiiranFun iṣeduro sample, ibi ti awọn awoṣe ṣe atilẹyin o.
presence_penalty
frequency_penalty
nọmbamiiranAwọn iṣakoso iṣakoso, kọọkan lati -2 si 2.
response_formatObirinmiiran{"type": "json_object"} Wọn {"type": "json_schema", "json_schema": {…}}, ni ibi ti awọn awoṣe ṣe atilẹyin. Ko lo nipasẹ nymbot/auto.
tools
tool_choice
parallel_tool_calls
array, string tabi ohun elo, booleanmiiranỌrọigbaniwọle: See awọn ọjaawọn a web_search Ọpa ti wa ni WẹẹbuNi o pọju 128 awọn ọpa ati 512 KB ti awọn ipo, ni o wa ni pọju 64 awọn ipo iwaju; diẹ sii ni a 400.
reasoning_effort
reasoning
ọrọìwòyemiiran"minimal", "low", "medium" Wọn "high"miiran {"effort": "high"}. "none" Wọn {"enabled": false} Ti o ba tẹsiwaju.See akojọ.
pluginsOṣuwọnmiiran[{"id": "web", "max_results": 5}] Ti o ba tẹsiwaju awọn ọna asopọ ti o ba tẹsiwaju awọn ọna asopọ. Up to 10 results.
nOṣuwọnmiiranOṣuwọn 1 - Oṣuwọn 1 - Oṣuwọn 1 - Oṣuwọn 1 - Oṣuwọn 1 400.
logit_bias
user
metadata
Ọrọìwòye, String, ObjectmiiranṢatunkọ ati ko tẹsiwaju. logit_bias maps ni ko si 300 token ids si awọn nọmba lati -100 si 100; user o ni tobi 256 awọn ẹya ara; metadata o ni to 16 awọn iye iye, awọn key to 64 awọn iye ati awọn iye to 512.

Ọrọìwòye jẹ awọn iroyin chat.completionTi o ba tẹsiwaju awọn owo ni usage.cost (ni USD) ati ninu awọn nymbot awọn ọja. model Ti o ba tẹsiwaju ki o jẹ id awọn awoṣe, ki o si a akọkọ orukọ lọ si bi awọn ti o pọju. If the model reasoned before answering, its reasoning is in message.reasoning_contentTi o ba tẹsiwaju lati awọn ibeere.

àwárí

{
  "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 ti wa ni ṣeto lati eyi ti o lọ si, nitori awọn onibara fi o ni diẹ ninu: tool_calls Ti o ba tẹsiwaju awọn ọna ẹrọ, length Ti o ba tẹsiwaju lilọ kiri aaye ayelujara yii, o ba tẹsiwaju lilọ kiri aaye ayelujara yii, o n gba awọn eto cookies wa. content_filter Ti o ba tẹsiwaju lilọ kiri aaye ayelujara yii, o n gba awọn eto cookies wa. stop miiran. usage.completion_tokens_details.reasoning_tokens ti wa ni ṣiṣe nigbagbogbo nipa 0: awọn iṣoro tẹlẹ tẹlẹ, ati ki o gbọdọ, ni completion_tokens.

olubasọrọakojọ
400miiran model Wọn messages (missing_required_parameter); awọn audio tabi awọn faili ẹya, tabi awọn fọto fun awọn awoṣe ti ko le ri wọn (unsupported_content); diẹ ẹ sii ju 20 awọn aworan (too_many_images); awọn iṣakojọpọ paramọta ti o wa ni iṣoro ti o wa ni iṣoro tabi ti o wa ni iṣoro (invalid_value); awọn ọna asopọ ti ko ba wa ni aaye (invalid_image_url); awọn ọja lori awọn awoṣe ti ko le npe ni wọn (unsupported_tool); n miiran ti 1; a :thinking Ti o ba tẹsiwaju lilọ kiri aaye ayelujara yii, o n gba awọn eto cookies wa.model_not_found); tabi ti o ba tẹsiwaju awọn ibeere (upstream_rejected).
402Awọn iye owo ti awọn awoṣe gbọdọ ko le fi awọn iṣakoso.
403Ti o ba tẹsiwaju lilọ kiri aaye ayelujara yii, o n gba awọn eto cookies wa.key_limit_reachedOṣuwọn max_tokens Ti o ba tẹ cap.
404Ọrọigbaniwọle (model_not_found).
429Iṣakoso iṣakoso Iṣakoso Iṣakoso (upstream_rate_limited).
502, 503Ọrọigbaniwọle (upstream_error) tabi ti o wa ni iṣeduro (upstream_overloadedmiiran Retry-AfterNibẹ ni eyikeyi ohun ti wa ni gbọdọ ti ko si awọn provider gbọdọ fun awọn igbeyewo.

Awọn koodu eto fun kọọkan endpoint awọn ẹya ara wa ni atilẹyin awọn iroyin.

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

akojọ

miiran "stream": true Ti o ba tẹsiwaju awọn iroyin ti o ba wa ni aṣiṣe bi awọn iroyin ti a fi sori ẹrọ nigba ti awọn awoṣe ṣiṣe o. Kọọkan iroyin ni a chat.completion.chunk awọn a data: akojọ, ati awọn akọkọ ti o ba wa pẹlu data: [DONE]Oju-iwe ti o wa ninu delta.reasoning_contentỌrọìwòye delta.content.

Wiwọle eyikeyi ti o le gba diẹ ẹ sii ju nipa 100 sekọnd, gẹgẹ bi a gbọdọ max_tokens Oṣuwọn ti a ko fi soriṣi ko fi soriṣi ko fi soriṣi nigbagbogbo awọn ifiranṣẹ ti o ni kikun, ati awọn nẹtiwọki laarin awọn ti o ati Nymbot le fi a ifọwọsi ti o ti wa ni iyanu lẹhin nipa 100 igbese; awọn awoṣe ti wa ni ṣaaju ati ohun ti o ti fi soriṣi ti wa ni fi soriṣi, ṣugbọn awọn ifiranṣẹ ti wa ni ti fi soriṣi.

akojọ

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]
  • awọn iroyin bẹrẹ pẹlu : Ti o ba tẹsiwaju awọn iroyin ti o wa ni ifihan, ti o ba tẹsiwaju gbogbo 15 iṣẹju nigba ti awọn awoṣe ti wa ni fẹ.
  • Ṣayẹwo fun "stream_options": {"include_usage": true} lati gba awọn akọkọ ti o pọju, pẹlu kan empty choicesTi o ba tẹsiwaju, awọn owo ati awọn nymbot awọn ọja.
  • Ti o ba tẹsiwaju ifowosowopo lẹhin akọsilẹ. Ti o ba tẹsiwaju ifowosowopo ni akọsilẹ, awọn awoṣe ti ko tẹsiwaju: Nymbot ṣayẹwo awọn sisan ti awọn provider's stream, fun to 25 akọsilẹ, lati gba awọn oniwe-tẹsiwaju nọmba, ati awọn ti o ba gba ohun ti awọn provider ṣayẹwo. Laisi ti o tẹsiwaju awọn iṣakoso ti wa ni iye lati rẹ input ati eyi ti a ti kọ, plus awọn gbogbo iṣeduro iṣeduro fun a awoṣe ti awọn ẹya ara.
  • Ọrọigbaniwọle ṣaaju ki o to akọkọ, bi 401 Wọn 402, tẹsiwaju gẹgẹbi JSON pataki pẹlu koodu itọju rẹ, ko bi ọna ọna. Awọn iṣoro lẹhin ti awọn ọna ti o ti wa ni bẹrẹ nwọn si wa ni akọkọ data: {"error": {…}} akọkọ, ati awọn akọkọ ti o ba wa ni ko [DONE].
  • Awọn ibeere pẹlu awọn ọpa, ati awọn awoṣe lori OpenAI's Responses ibaraẹnisọrọ, ko fi sori lati awọn provider. Nwọn tun fi sori ẹrọ pẹlu a gbe sori ẹrọ, fi sori ẹrọ nigba ti awọn ibeere ti wa ni pipe.

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

awọn ọja

Ṣatunkọ awọn iṣẹ ni tools ati awọn awoṣe le fẹ lati ọkan lati wa ni fẹ lati wa ni fẹ lati wa ni ifọwọsi. O ṣiṣẹ awọn iṣẹ, fi awọn oniwe-ẹrọ rẹ bi a tool Ọrọigbaniwọle pẹlu awọn wọnyi tool_call_idNymbot ko ṣiṣe awọn iṣẹ rẹ; o fi awọn ibeere ti awọn awoṣe si rẹ.

tool_choice ṣayẹwo "auto", "none", "required" Wọn {"type": "function", "function": {"name": "…"}}Ṣatunkọ awọn ẹya ara ẹya ara ẹya ara ẹya ara (capabilities.tools) Awọn ọpa ti wa ni rejected pẹlu 400 unsupported_tool O si nymbot/auto ati lori awọn ọpọlọpọ awọn awoṣe catalogu ti ṣiṣẹ lori OpenAI's Responses transport, eyi ti Nymbot ko le fi awọn ọpa si.

miiran "stream": true, a ifiranṣẹ pẹlu awọn ọpa ṣiṣẹ ni ọkan ẹya ati ki o si lọ si bi a gbajumo chunk iṣakoso: awọn ẹya, ọkan chunk pẹlu kọọkan ọpa ibaraẹnisọrọ pẹlu awọn oniwe-ọna, id, orukọ ati awọn arguments, ati awọn ti o tẹsiwaju chunk. Awọn onibara ti o tẹsiwaju awọn ọpa ibaraẹnisọrọ ṣiṣe o bi o ti ṣee ṣe.

Ọrọigbaniwọle, ni apakan

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

awọn fọto ni ifiranṣẹ

Awọn awoṣe pẹlu capabilities.vision Mo le tẹsiwaju awọn fọto. Fi image_url aṣayan si ọja olumulo, pẹlu eyikeyi aṣayan https:// awọn iroyin A data:image/…;base64, Ti o ba tẹsiwaju lilọ kiri aaye ayelujara yii, o n gba awọn aaye ayelujara yii, awọn aaye ayelujara yii, awọn aaye ayelujara yii, awọn aaye ayelujara yii, awọn aaye ayelujara yii, awọn aaye ayelujara yii, awọn aaye ayelujara yii ati awọn aaye ayelujara yii.400 invalid_image_urlaṣiṣe optional detail O si auto, low Wọn high.

miiran nymbot/auto, a ifiranṣẹ pẹlu awọn fọto ni o ti wa ni router to a standard model ti o le ri. A catalog model laisi capabilities.vision Tẹle awọn fọto pẹlu 400 unsupported_contentAwọn fọto le wa ni nikan ninu awọn olumulo ti olumulo. A ipinnu yẹ ki o tọkasi si a gbajumo; Nymbot fi awọn fọto si awọn olupese ti awọn awoṣe ati ki o ko fi o.

A fọto ti wa ni gbọdọ bi awọn input tokens awọn provider kọ fun o, gẹgẹ bi awọn miiran ti awọn ibeere.

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

akojọ

Awọn awoṣe pẹlu capabilities.reasoning O le ṣayẹwo rẹ ṣaaju ki o si wa ni diẹ ninu awọn aṣa. reasoning_effort ("minimal", "low", "medium" Wọn "high"aṣa "reasoning": {"effort": "high"}Ti o ba tẹ :thinking si awọn awoṣe orukọ, eyi ti o npe ni ilọsiwaju. Nipa awoṣe laisi iṣoro, awọn ipo ti wa ni igbadun. Nipa nymbot/auto, :thinking Ṣatunkọ awọn ibeere si awọn iṣiro iṣiro iṣiro.

On Anthropic awọn awoṣe awọn iṣẹ ti wa ni a gbe owo ti nipa 1,000, 2,000, 8,000 tabi 16,000 tokens, ko siwaju sii ju max_tokens Ti o ba tẹsiwaju, awọn ipo ti wa ni tẹsiwaju nigbati tool_choice Ti o ba tẹsiwaju a ọpa, ati nigba ti awọn ibeere tẹsiwaju a tool loop (iwe akọkọ tẹsiwaju ni a ọpa result), nitori Anthropic gbọdọ awọn tẹsiwaju tẹsiwaju tẹsiwaju lati tẹsiwaju o.

Ọrọìwòye tẹsiwaju lọ si message.reasoning_contentmiiran delta.reasoning_content Ti o ba tẹsiwaju awọn iroyin ti o ba tẹsiwaju awọn iroyin ti o ba tẹsiwaju awọn iroyin ti o ba tẹsiwaju awọn iroyin ti o tẹsiwaju awọn iroyin. completion_tokensỌpọlọpọ awọn onibara ko fi awọn ọrọ iṣiro ni gbogbo, ati awọn ti o ti wa ni ṣaaju.

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

Ọrọìwòye

A tẹsiwaju lori awọn awoṣe orukọ ti o mu bi awọn ibeere ti wa ni sise, laisi ọpọlọpọ miiran ibi. A ṣiṣẹ lori awọn id ati awọn titun awọn orukọ bi daradara, bi ni anthropic/claude-sonnet-5:online.

awọn ọjaàwárí
:onlineTi o ba tẹsiwaju ayelujara kan akọkọ, bi plugins: [{"id": "web"}]àwárí Wẹẹbu.
:thinkingỌpọlọpọ awọn ẹya ara; on nymbot/autoTi o ba tẹsiwaju, nipa awoṣe ti o ko le ṣe iwaju, 400 model_not_found awọn ọja “no endpoints found”.
:nitro, :floor, :exacto, :extendedGbogbo awoṣe catalog nibẹ ni ọkan ọna, ki o si nibẹ ni ko siwaju sii, owo owo, tabi siwaju sii lati yan; awọn afikun ti wa ni le ki awọn awoṣe orukọ kopa lati awọn miiran awọn iṣẹ tun ṣiṣẹ.

Gbogbo orilẹ-ede miiran ti wa ni igbeyewo. Gbogbo orilẹ-ede ti wa ni igbeyewo ni akọkọ, ki a awoṣe ti id ti o npe ni a kolon ti wa ni ṣiṣe ṣiṣe; ti o ko ba ti o, awọn afikun ti wa ni tẹsiwaju lati ibi ọkan ni ọkan ni ọkan ni ọkan. A awoṣe orilẹ-ede le wa ni to 200 awọn akọkọ pẹlu to to 4 awọn afikun; a siwaju sii ọkan ti wa ni ti wa ni ko siwaju pẹlu 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);

Gbogbo awọn awoṣe iroyin le yan lati ayelujara. Nymbot iroyin fun awọn akọkọ olumulo iroyin (ni awọn akọkọ 2,000 iroyin), o kọ awọn ti o dara ju ojúewé ati fi wọn si awọn awoṣe pẹlu awọn ibeere, ti a ti tẹle bi awọn ohun elo ti o wa ko le gba awọn iroyin lati awoṣe. Nibẹ ni meji ipo:

  • Ti o ba tẹsiwaju: "plugins": [{"id": "web", "max_results": 5}]O si a :online Ti o ba tẹsiwaju lori awọn awoṣe.
  • Ṣayẹwo nigba ti o ṣe iranlọwọ: "tools": [{"type": "web_search", "parameters": {"max_results": 5}}]Tẹle siwaju sii bi web_search_preview Wọn openrouter:web_searchNymbot ṣayẹwo nikan nigba ti awọn ibeere fihan pe o nilo awọn alaye akọkọ, awọn ọna kanna ti awọn app lo.

max_results ni 5 nipasẹ iṣeduro ati ni o pọju 10. Awọn orisun lọ si nymbot.web_search.sourceskọọkan pẹlu a title, snippet ati urlO si as url_citation Ọrọìwòye lori awọn ọrọìwòye.

Gbogbo awọn iroyin ti o ṣiṣẹ ni owo $ 0.008, ti a fi si sats, lori awọn tokens, ati pe o jẹ ọkan ninu awọn iṣakoso. Awọn ojúewé ti o wo ni input tokens tun, nitorina a yan lati ayelujara ni owo diẹ ẹ sii ju awọn wọnyi ibeere ti a ṣe iyanu, nigbagbogbo ọpọlọpọ igba diẹ sii.

Ọrọigbaniwọle, ni apakan

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

Oṣuwọn API

OpenAI jẹ ẹya ti o dara julọ, ti a lo nipasẹ awọn OpenAI Agents SDK ati awọn Codex. O ṣiṣẹ lori awọn wọnyi awọn awoṣe, owo ati awọn ẹya ara ẹrọ bi Chat Completions.

POST https://nymbot.ai/api/v1/responses — O nilo a API key.

Orilẹ-edeÀwọn ẹkaWọleỌrọìwòye
modelọrọìwòyeBẹẹniawọn ọja Gbogbo awọn chatTi o ba wa ni awọn suffixes.
inputỌrọigbaniwọle ArrayBẹẹniA string, tabi ọrọìwòye awọn ọja: awọn ọrọìwòye user, assistant, system, developeraṣa input_text, input_image ati output_text awọn ẹya ara, ati function_call ati function_call_output awọn ọja fun awọn ọja. input_image O ṣeun image_url iroyin tabi data URL, ko si faili id. reasoning ati web_search_call awọn ẹya ara ẹya ara; item_reference O si rán.
instructionsọrọìwòyemiiranIṣakoso eto.
max_output_tokensOṣuwọnmiiranỌpọlọpọ awọn aṣa lati kọ.
temperature
top_p
nọmbamiiranSampling awọn iṣakoso, ibi ti awọn awoṣe gba wọn.
tools
tool_choice
parallel_tool_calls
array, string tabi ohun elo, booleanmiiranTi o ba tẹsiwaju lilọ kiri aaye ayelujara yii, o n gba awọn eto cookies wa.{"type": "function", "name": …, "parameters": …}aṣa web_search Wọn web_search_preview Ọpa ti wa ni Wẹẹbu Ti o ba tẹsiwaju. Awọn ọpa miiran ti a fi sori ẹrọ.
reasoningObirinmiiran{"effort": "minimal" | "low" | "medium" | "high"}. xhigh ati max miiran high; none Ti o tẹsiwaju.
text.format
response_format
ObirinmiiranṢatunkọ ipele, gẹgẹ bi a JSON eto tabi json_object.
metadataObirinmiiranṢiṣakoso ko ṣiṣakoso ni ifọwọkan. Ni o pọju 16 iwọn iwọn iwọn, awọn iwọn to 64 iwọn, ati awọn iwọn to 512.
streamọrọìwòyemiiranGbigba awọn iṣowo gẹgẹbi awọn wọnyi ni isalẹ.
storeọrọìwòyemiiranNibẹ ni ko siwaju. Nibẹ ni ko siwaju, ati awọn ifiranṣẹ ti o wa ni "store": false.
previous_response_id
conversation
background
ọrọìwòye, Object, BooleanmiiranTi o ba tẹsiwaju: 400 unsupported_parameterAwọn atilẹyin ko ti wa ni fi sori ẹrọ, ki o si fi gbogbo awọn ibaraẹnisọrọ ni input Gbogbo akoko

àwárí

{
  "id": "resp_8c1e4b0f9a2d4e61",
  "object": "response",
  "created_at": 1790726400,
  "status": "completed",
  "model": "anthropic/claude-sonnet-5",
  "output": [
    {
      "type": "message",
      "id": "msg_2b7f",
      "role": "assistant",
      "status": "completed",
      "content": [{ "type": "output_text", "text": "A Lightning invoice is...", "annotations": [] }]
    }
  ],
  "output_text": "A Lightning invoice is...",
  "usage": {
    "input_tokens": 1240,
    "input_tokens_details": { "cached_tokens": 0 },
    "output_tokens": 380,
    "output_tokens_details": { "reasoning_tokens": 0 },
    "total_tokens": 1620
  },
  "incomplete_details": null,
  "error": null,
  "instructions": null,
  "store": false,
  "previous_response_id": null,
  "metadata": {},
  "nymbot": { "balance": "pro", "charged_credits": 0.162, "charged_sats": 16.2, "balance_credits": 412.425, "balance_sats": 41242.5 }
}

A ọpa ifiranṣẹ ṣeto ninu output awọn a function_call Àwọn ẹka call_id, name ati argumentsṢatunkọ awọn iwọn lilo a function_call_output Àwọn ẹka pẹlu awọn wọnyi call_idṢatunkọ, nigbati awọn awoṣe fi o, o jẹ a reasoning Àwọn ẹka reasoning_text Ti o ba tẹsiwaju, tẹsiwaju akọkọ. status O si incomplete Ti o ba tẹsiwaju awọn ibeere max_output_tokens Ti o ba tẹsiwaju lilọ kiri aaye ayelujara yii, o n gba awọn eto cookies wa. incomplete_details.reason àwárí max_output_tokens Wọn content_filterAwọn ifiranṣẹ tun ṣe awọn ipo ti awọn ifiranṣẹ (temperature, ọpa, tool choice ati bẹ bẹ bẹ bẹ) bi OpenAI ṣe, ati ṣe awọn ifiranṣẹ nymbot Owo owo.

Oṣuwọn, kọọkan akọkọ jẹ event: Oṣuwọn A data: awọn line pẹlu a sequence_numberNi isalẹ yi: response.created, response.in_progress, response.output_item.added, response.content_part.addedGbogbo nọmba ti response.output_text.delta, response.output_text.done, response.content_part.done, response.output_item.doneTi o ba tẹlẹ response.completed Ti o ba tẹsiwaju ki o si tẹsiwaju ki o si tẹsiwaju ki o si tẹsiwaju ki o si tẹsiwaju ki o si tẹsiwaju. response.incomplete ṣugbọn ṣugbọn, ti o ba tẹsiwaju lẹhin ti o bẹrẹ pẹlu response.failedṢatunkọ awọn ẹya ara bi awọn ẹya ara rẹ pẹlu response.reasoning_text.delta ati .doneAwọn ọna ifowosowopo wa lẹhin ifowosowopo, kọọkan bi ọja pẹlu response.function_call_arguments.delta ati .done.

olubasọrọakojọ
400miiran model Wọn input; previous_response_id, conversation, background O ṣeun item_reference (unsupported_parameter); ọpa tabi iru ohun elo ti ko wa ni aṣoju.
402, 403, 404, 429, 502, 503Ti o ba tẹsiwaju awọn chat.

cURL

curl https://nymbot.ai/api/v1/responses \
  -H "Authorization: Bearer $NYMBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-5",
    "instructions": "Answer in one short paragraph.",
    "input": "What is a Lightning invoice?"
  }'

Python

import os
from openai import OpenAI

client = OpenAI(base_url="https://nymbot.ai/api/v1", api_key=os.environ["NYMBOT_API_KEY"])

response = client.responses.create(
    model="anthropic/claude-sonnet-5",
    instructions="Answer in one short paragraph.",
    input="What is a Lightning invoice?",
)
print(response.output_text)

JavaScript

import OpenAI from "openai";

const client = new OpenAI({ baseURL: "https://nymbot.ai/api/v1", apiKey: process.env.NYMBOT_API_KEY });

const response = await client.responses.create({
  model: "anthropic/claude-sonnet-5",
  instructions: "Answer in one short paragraph.",
  input: "What is a Lightning invoice?",
});
console.log(response.output_text);

Ọrọìwòye Antropic

Itumọ ti Anthropic, fun awọn Anthropic SDKs ati Claude Code. O ṣiṣẹ pẹlu gbogbo awọn awoṣe ni iwe-aṣẹ, ko nikan Claude: awọn ibeere ti wa ni ṣeto, ṣiṣẹ nipasẹ awọn kanna pipeline, ati ṣeto lẹhin.

POST https://nymbot.ai/api/v1/messages — o nilo API key, bi x-api-key Wọn Authorization: Bearer.

awọn anthropic-version ati anthropic-beta Antropic awoṣe awọn orukọ ti wa ni ibamu si awọn catalogu, ki Claude Code ati awọn SDKs ṣiṣẹ pẹlu awọn orukọ ti o ti wa ni tun lilo:

  • Ọpọlọpọ awọn orukọ ti o mọ, bi claude-sonnet-5 Wọn anthropic/claude-opus-5O ti wa ni lo bi o jẹ.
  • Ti o ba tẹsiwaju (-20260514), -latestỌrọigbaniwọle bi -v1Ti o ba tẹsiwaju ki o si [1m] awọn ọja anthropic/ Wọn anthropic. Ti o ba tẹsiwaju lilọ kiri aaye ayelujara yii, o ba tẹsiwaju lilọ kiri aaye ayelujara yii, o n gba awọn eto cookies wa.claude-haiku-4-5 Wọle claude-haiku-4.5).
  • Ti o ba ṣugbọn ko siwaju, awọn aṣa (Opus, Sonnet tabi Haiku) ti wa ni lo, biotilejepe ti awọn katalogu ti wa ni ọkan tabi diẹ ẹ sii ju ọkan ti o fẹ lati.
  • Ọrọigbaniwọle: A name that matches nothing returns 404 not_found_error.
Orilẹ-edeÀwọn ẹkaWọleỌrọìwòye
modelọrọìwòyeBẹẹniA katalogu model id, tabi a Anthropic model orukọ.
max_tokensOṣuwọnBẹẹniỌpọlọpọ awọn aṣa lati kọ.
messagesOṣuwọnBẹẹniuser ati assistant awọn iroyin, pẹlu text, image (base64 tabi orisi URL), tool_use ati tool_result miiran bloke thinking awọn blocks lati awọn akọkọ iṣiro ti wa ni gba ati fi kun.
systemỌrọigbaniwọle ArraymiiranSystem prompt, gẹgẹbi a string tabi awọn ọrọ.
temperature
top_p
nọmbamiiranSampling awọn iṣakoso, ibi ti awọn awoṣe gba wọn. top_k O ti wa ni akọkọ ati tọju.
stop_sequencesawọn ọja StringsmiiranTẹle ti o tẹsiwaju awọn ibeere. Ni o pọju 4 akọsilẹ, kọọkan ni o pọju 256 akọsilẹ.
tools
tool_choice
awọn ẹya ara ẹrọmiiranawọn ọja pẹlu name, description ati input_schemaawọn a web_search Server Tool ṣiṣe Wẹẹbu; Awọn ọpa miiran ti Anthropic ti a fi sori ẹrọ (bash, text editor, kọmputa lilo) ti wa ni fi sori ẹrọ pẹlu unsupported_tool. tool_choice ṣayẹwo auto, any, tool Wọn noneO si disable_parallel_tool_use.
thinkingObirinmiiran{"type": "enabled", "budget_tokens": 8192}, {"type": "adaptive"} Wọn {"type": "disabled"}Iṣakoso pẹlu iwọn iṣoro: labẹ 2,048 kekere, lati 2,048 kekere, lati 8,192 media, lati 16,384 ga. output_config.effortTi o ba wa ni ga.
streamọrọìwòyemiiranGbigba awọn iṣẹlẹ ni Anthropic.
metadataObirinmiiranTi o ba tẹsiwaju ati ignore.

àwárí

{
  "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 Ṣe o wa tool_use awọn iroyin ati a thinking Ọrọìwòye signature O ti wa ni empty. stop_reason O si end_turn, max_tokens, tool_use Wọn refusalṢiṣeto ni awọn ọna bi finish_reason O si Gbogbo awọn chat; stop_sequence Ọlọrun null, ṣugbọn ṣugbọn nigba ti iṣakoso iṣakoso ti iṣakoso. input_tokens Ṣatunkọ ipinnu: Awọn ipinnu ṣatunkọ jẹ ninu awọn orilẹ-ede meji. nymbot Obirin ati awọn X-Nymbot-Cost-Sats ọrọìwòye

Ti o ba tẹsiwaju, awọn esi ni Anthropic's: message_start, content_block_start, ping, content_block_delta (text_delta, input_json_delta Wọn thinking_delta), content_block_stop, message_delta awọn ọna asopọ, awọn lilo ati awọn nymbot owo owo, ati message_stopawọn a ping Ti o ba tẹsiwaju awọn ọna asopọ, awọn ọna asopọ ti wa ni tẹsiwaju lẹhin awọn ọna asopọ, kọọkan bi a tool_use aṣa pẹlu gbogbo awọn itọju rẹ ni ọkan input_json_delta.

Awọn iṣoro ninu ipo yi lo iroyin ti Anthropic: {"type": "error", "error": {"type": "not_found_error", "message": "…"}}Ti o ba tẹsiwaju iye owo 402 billing_errorỌpọlọpọ awọn onibara 503 overloaded_errorAṣayan lẹhin lẹhin ti stream ti wa ni bẹrẹ ti wa ni fi error Ọrọìwòye

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

Tẹle awọn tokens

Ọrọìwòye ti o ba ṣee lo ọpọlọpọ awọn input tokens a Messages ibeere yoo lo, ki o si awọn onibara le tẹle ṣaaju ki o to ṣaaju. O jẹ free, ṣugbọn o tun nilo a key.

POST https://nymbot.ai/api/v1/messages/count_tokens — o nilo API key. Free.

Orilẹ-ede jẹ ọkan ninu awọn ỌrọìwòyeWọn ni max_tokens; awọn awoṣe orukọ ni lati sọrọ. Iṣeduro ni a iṣeduro: awọn akọkọ ti awọn eto ifowosowopo, awọn ifowosowopo, awọn ọna ifowosowopo ati awọn ẹya ara ẹya ara ẹya ara ẹni nipasẹ awọ, plus 1,600 fun kọọkan awọn aworan. O ko jẹ tokenizer rẹ, ki o si iṣeduro nikan le diẹ. A key eyi ti o ti lọ si awọn iṣeduro rẹ le tun lo o.

àwárí

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

Awọn awoṣe

Gbogbo awọn awoṣe ati awọn generator API gba, pẹlu ohun ti o ba wa ni owo. Awọn nọmba ti wa ni kọ lati ọna kanna kanna catalogu bi awọn app's picker, nitorina o jẹ nibẹ ni eyi ti o yoo ṣiṣẹ.

GET https://nymbot.ai/api/v1/models — ko ba gbọdọ awọn key. Gbigba fun 5 iṣẹju.

GET /api/v1/models/{id} Ṣatunkọ si 1 entry.

Orilẹ-edeÀwọn ẹkaWọleỌrọìwòye
typeỌrọigbaniwọlemiiranchat Ti o ba tẹsiwaju, image, video, audio, embedding Wọn allỌpọlọpọ awọn ti o le ṣe, bi image,video.

Owo ni ohun ti o ba fẹ, pẹlu awọn owo ati marun ni o wa ni, ni dollars ati ni sats ni ojoojumọ Bitcoin owo. balance Ti o ba tẹsiwaju pe iṣeduro iṣeduro. nymbot_key o jẹ orukọ ti awọn awoṣe ni app. created ni o wa nikan ninu 0, nitori awọn katalogu ko tẹsiwaju nigbati a awoṣe ti a ti fi siwaju. A awoṣe ti ko ba ti a ti fi tẹsiwaju tẹsiwaju per_request dipo.

nymbot/auto Ti o ba wa ni akọkọ, o wa ni owo bi variableNipa a routes Ti o ba tẹsiwaju awọn ọna asopọ ti gbogbo awọn ọna asopọ. O tẹsiwaju awọn iwaju ati awọn iṣoro, ṣugbọn ko awọn ọna.

GET /api/v1/models/{id} o gba awọn wọnyi awọn orukọ ati awọn alabapin bi a ibeere, ati ki o fi awọn ibaraẹnisọrọ fun awọn awoṣe ti o tẹsiwaju.

àwárí

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

awọn ọja miiran:

  • ọrọìwòye Wọn ni capabilities (accepts_image_url, requires_image_url, edit) ati awọn owo per_generation.
  • Wọle Wọn ni max_duration_seconds ati resolutionsAti awọn owo per_second fun kọọkan aṣayan.
  • akojọ Wọn ni audio_type speech Wọn transcriptionowo owo per_1k_chars Wọn per_minute.
  • àwárí Wọn ni dimensions, context_length, max_inputs owo fun ọpọlọpọ awọn million input tokens.

awọn ọja "estimated": true o jẹ iye iye ti awọn app fun a generator ti o ni owo ko ti wa ni ko ṣeto. type awọn iroyin 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);