콘텐츠로 건너뛰기
Nymbot로 돌아가기

지식 기반 개발자

채팅, 응답 및 메시지

모델에게 뭔가를 묻는 세 가지 방법, 이미 말하는 세 가지 형식에서 고객은 모두 동일한 모델을 실행하고 동일한 방식으로 청구합니다.

채팅 완료

OpenAI 채팅 형식, 그리고 거의 모든 도구가 지원하는 하나.지금까지 대화를 보내 다음 메시지를 다시 받으십시오.

POST https://nymbot.ai/api/v1/chat/completions API 키가 필요합니다.

오직 model 그리고 messages 선택한 모델이 채택하지 않는 샘플링 매개 변수는 오류없이 떨어집니다, 그래서 하나의 요청 몸은 모델을 통해 작동합니다. supported_parameters포기하는 대신 거부되는 것은 모델이 할 수없는 모든 것입니다 : 볼 수없는 모델에 대한 사진, 그들을 호출 할 수없는 모델에 대한 도구.

필드타입필요성설명서
modelString예nymbot/auto (또는 auto) 표준 균형에 Nymbot의 라우팅, 또는 카탈로그 모델 ID anthropic/claude-sonnet-5 Pro 밸런스에서. 앱의 짧은 이름과 별명도 받아들여집니다. 충분히.
messagesArray예대화 - 역할 system, developer (시스템으로 처리되는 경우) user, assistant 그리고 tool컨텐츠는 문자열 또는 목록입니다.Content is a string or a list of text 그리고 image_url 일부; 사진은 사용자 메시지에만 포함됩니다. input_audio 파일의 일부는 거부됩니다.
streamboolean아니오글을 쓰고 있는 대답을 보내주세요.더 보기 스트리밍.
stream_options개체아니오{"include_usage": true} 토큰 계산과 비용을 포함한 최종 조각을 추가합니다.
max_tokens
max_completion_tokens
통합아니오가장 많은 토큰을 쓸 수 있습니다.더 높은 경우 모델의 최대까지 낮추십시오.또한 잔액에서 얼마나 많이 보유되는지 설정하므로 더 작은 숫자가 시작하기 위해 더 적은 크레딧을 필요로합니다.
temperature
top_p
숫자아니오샘플링 컨트롤 : temperature 0에서 2까지, top_p 0부터 1까지
stopstring 또는 array아니오답을 끝내는 텍스트: 문자열 또는 최대 4개의 문자열, 각각 최대 256자. nymbot/auto.
seed통합아니오모델이 그것을 지원하는 반복 샘플링을 위해.
presence_penalty
frequency_penalty
숫자아니오반복 컨트롤, 각각 -2에서 2.
response_format개체아니오{"type": "json_object"} 또는 {"type": "json_schema", "json_schema": {…}}모델이 그것을 지원하는 경우.Not used by nymbot/auto.
tools
tool_choice
parallel_tool_calls
배열, 문자열 또는 개체, boolean아니오통화 기능: See 도구 전화· A web_search 도구가 변한다 WEB 검색최대 128 도구 및 512 KB의 정의, 최대 64 레벨 깊이에 삽입; 더 많은 400.
reasoning_effort
reasoning
링크, 개체아니오"minimal", "low", "medium" 또는 "high"또는 {"effort": "high"}. "none" 또는 {"enabled": false} 그것을 끄십시오. see 논리.
pluginsArray아니오[{"id": "web", "max_results": 5}] 항상 웹을 먼저 검색합니다.최대 10 결과.
n통합아니오단지 1 - 다른 모든 것이 돌아옵니다. 400.
logit_bias
user
metadata
문자열, 문자열, 개체아니오받았고 보내지 않았습니다. logit_bias - -100에서 100까지의 숫자로 최대 300 개의 토큰 ID의 맵; user 최대 256개의 캐릭터가 있습니다. metadata 최대 16 개의 문자열 값, 최대 64 개의 문자 키 및 최대 512 개의 값을 보유합니다.

대답은 평범한 chat.completion, 비용을 포함하여 usage.cost (달러로) 그리고 그 안에서 nymbot 개체를 model 해결된 모델 id, 그래서 짧은 이름은 전체 이름으로 돌아옵니다. message.reasoning_content답과는 분리되어 있다.

대답

{
  "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 제공자가 다르게보고하기 때문에 돌아온 것에서 개발되었습니다 : tool_calls 모델이 도구를 요구할 때, length 응답이 허용되는 모든 토큰을 사용했을 때 (또는 모델이 그들을 모두 추론하고 아무런 대답도 쓰지 않았을 때), content_filter 제공자가 거절했을 때, 그리고 stop 그렇지 않으면 usage.completion_tokens_details.reasoning_tokens 항상 0 : 숨겨진 추론 토큰이 계산되고 부과됩니다. completion_tokens.

상태언제
400아니오 model 또는 messages (missing_required_parameter); 그들을 볼 수없는 모델의 오디오 또는 파일 부분 또는 이미지 (unsupported_content20 개 이상의 사진 (too_many_images(이하 샘플링 매개 변수의 잘못된 유형 또는 범위 (invalid_value); 공개되지 않은 사진 링크 (invalid_image_url); 모델에 도구를 호출 할 수없는 (unsupported_tool); n 1 이외에; a :thinking 이유를 알 수없는 모델에 대한 충분성 (model_not_found(또는 제안자가 요청을 거부했을 경우)upstream_rejected).
402모델이 지출하는 잔액은 보유를 덮을 수 없습니다.
403최악의 경우는 키의 캡에 맞지 않습니다 (key_limit_reached1) 낮은 max_tokens 또는 캡을 올리십시오.
404이 이름의 모델이 없음 (No model by that name)model_not_found).
429공급자의 가격 제한, 또는 공급자의 가격 제한 (upstream_rate_limited).
502, 503공급자가 실패한 경우 (upstream_error) 또는 과부하가 있음 (upstream_overloaded, 와 Retry-After제공자가 시도를 청구하지 않는 한 아무것도 청구되지 않습니다.Nothing is charged unless the provider billed for the attempt.

각 엔드포인트 주식의 상태 코드는 아래에 나열됩니다.The status codes each endpoint shares are listed under 실수.

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

스트리밍

와 "stream": true 응답은 모델이 작성하는 동안 서버로 전송된 이벤트로 도착합니다.Each event is a chat.completion.chunk 는 A data: 라인, 그리고 흐름이 끝나는 data: [DONE]이성은 들어오는 delta.reasoning_content그리고 답은 in delta.content.

긴 대답, 큰 대답과 같은 약 100초 이상 걸릴 수 있는 무언가를 스트리밍하세요. max_tokens 응답이 완료 될 때까지 스트리밍되지 않은 요청은 아무것도 보내지 않으며, 당신과 Nymbot 사이의 네트워크는 약 100 초 후에 빈번한 연결을 닫을 수 있습니다; 모델은 여전히 완료되고 그것이 쓴 것이 충전되지만 응답은 손실됩니다.

스트림

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]
  • 라인 시작 with : 모델이 생각하는 동안 매 15 초마다 보낸 살아있는 코멘트입니다.SSE 고객은 그들을 건너 니다.
  • 물어보세요 "stream_options": {"include_usage": true} 위의 마지막 조각을 얻으려면, 빈 조각으로 choices, 토큰 계산, 비용 및 nymbot 개체를
  • 충전은 스트림이 끝난 후에 정해집니다. 만약 연결을 일찍 닫으면 모델은 멈추지 않습니다: Nymbot은 공급자의 스트림의 나머지 부분을 최대 25초 동안 읽어 토큰 계산을 얻고 공급자가 보고하는 것을 지불합니다.
  • 첫 번째 부분에 대한 오류, 예를 들면 401 또는 402흐름이 시작된 후에 오류가 마지막으로 도착합니다. , comes back as ordinary JSON with its status code, not as a stream. data: {"error": {…}} 이벤트, 그리고 흐름이 끝나지 않고 [DONE].
  • OpenAI의 응답 전송에 있는 도구와 모델에 의한 요청은 공급자로부터 스트림이 되지 않습니다.They still respond with a valid stream, sent once the answer is complete.

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

도구 전화

기능을 설명하는 것 in tools 그리고 모델은 응답 대신에 하나를 호출하도록 요청할 수 있습니다.You run the function, add its result as a tool 같은 메시지와 같은 tool_call_idNymbot는 결코 당신의 기능을 실행하지 않습니다; 그것은 당신에게 모델의 요청을 전달합니다.

tool_choice 가져가 "auto", "none", "required" 또는 {"type": "function", "function": {"name": "…"}}모델 목록은 어떤 모델이 도구를 호출할 수 있는지 표시합니다 (capabilities.tools도구는 거부됩니다 with 400 unsupported_tool 는 nymbot/auto 그리고 Nymbot이 도구를 전달할 수없는 OpenAI의 Responses 트랜스포트에서 실행되는 몇 가지 카탈로그 모델.

와 "stream": true, 도구와 함께 요청은 하나의 조각으로 실행되고 정상적인 조각 순서로 전송됩니다 : 역할, 하나의 조각은 각 도구 호출을 인덱스, ID, 이름 및 논리, 그리고 마무리 조각으로 운반합니다.Clients who read streamed tool calls handle it as usual.

대답은 부분적으로

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

요청에 포함된 사진

모델 with capabilities.vision 사진을 읽을 수 있습니다.Add a image_url 사용자 메시지의 일부, 또는 대중과 함께 https:// 링크 또는 A data:image/…;base64, 이 게시물을 즐겨찾기로 설정 8월 9일 (현재 사용자 이름 또는 비밀번호가 포함되어 있음)400 invalid_image_url1) 선택적 detail 이 auto, low 또는 high.

와 nymbot/auto, 그 안에 그림이 있는 요청은 볼 수 있는 표준 모델로 라우팅됩니다.A catalog model without capabilities.vision 사진을 거부하는 것 400 unsupported_content사진은 사용자 메시지에만 있을 수 있습니다. 링크는 공개 호스트를 가리키어야 합니다; Nymbot는 모델의 공급자에게 사진을 전달하고 그것을 보관하지 않습니다.

그림은 공급자가 요청의 나머지 부분과 마찬가지로 입력 토큰으로 청구됩니다.A picture is charged as the input tokens the provider counts for it, like the rest of the request.

cURL

curl https://nymbot.ai/api/v1/chat/completions \
  -H "Authorization: Bearer $NYMBOT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "anthropic/claude-sonnet-5",
    "messages": [{
      "role": "user",
      "content": [
        {"type": "text", "text": "What is in this picture?"},
        {"type": "image_url", "image_url": {"url": "https://example.com/receipt.jpg"}}
      ]
    }]
  }'

Python

import base64, os
from openai import OpenAI

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

with open("receipt.jpg", "rb") as f:
    data_url = "data:image/jpeg;base64," + base64.b64encode(f.read()).decode()

reply = client.chat.completions.create(
    model="anthropic/claude-sonnet-5",
    messages=[{
        "role": "user",
        "content": [
            {"type": "text", "text": "What is in this picture?"},
            {"type": "image_url", "image_url": {"url": data_url}},
        ],
    }],
)
print(reply.choices[0].message.content)

JavaScript

import { readFile } from "node:fs/promises";
import OpenAI from "openai";

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

const dataUrl = "data:image/jpeg;base64," + (await readFile("receipt.jpg")).toString("base64");

const reply = await client.chat.completions.create({
  model: "anthropic/claude-sonnet-5",
  messages: [{
    role: "user",
    content: [
      { type: "text", text: "What is in this picture?" },
      { type: "image_url", image_url: { url: dataUrl } },
    ],
  }],
});
console.log(reply.choices[0].message.content);

이론화

모델 with capabilities.reasoning 대답하기 전에 생각할 수 있습니다.더 또는 더 적게 요청하십시오. reasoning_effort ("minimal", "low", "medium" 또는 "high") 또는 "reasoning": {"effort": "high"}또는 추가 :thinking 모델 이름, 즉 높은 노력을 의미합니다. 이유없이 모델에서 설정이 무시됩니다. nymbot/auto, :thinking 요청을 표준 추론 경로로 전송합니다.

Anthropic 모델에서 노력은 약 1,000, 2,000, 8,000 또는 16,000 토큰의 사고 예산이됩니다. max_tokens 생각은 멈추고, 생각은 멈추고, tool_choice 도구를 강요하고, 요청이 도구 루프를 계속할 때(최종 메시지는 도구 결과이기 때문에), Anthropic은 이전에 서명한 생각을 필요로 하기 때문에 그것을 재개합니다.

이론은 다시 돌아온다 message.reasoning_content또는 delta.reasoning_content 스트리밍할 때, 결코 답에 섞이지 않는다.결론은 출력이며, 내부에서 그러한 것으로 충전된다. completion_tokens일부 공급자는 이유 텍스트를 전혀 반환하지 않으며 여전히 요금이 부과됩니다.

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

모델 suffixes

모델 이름의 부속은 요청이 다른 필드없이 처리되는 방식을 변경합니다.They work on full ids and short names alike, as in anthropic/claude-sonnet-5:online.

충분히효과
:online웹사이트를 먼저 찾는 것처럼, plugins: [{"id": "web"}]이 WEB 검색.
:thinking높은 논리적 노력; on nymbot/auto논리적 경로, 논리적 경로 : 논리적 경로가 존재하지 않는 모델에서, 400 model_not_found 그리고 “no endpoints found” 를 찾을 수 있습니다.
:nitro, :floor, :exacto, :extended각 카탈로그 모델에는 하나의 경로가 있으므로 더 빠르거나, 더 저렴하거나, 더 긴 경로가 없으므로, 다른 서비스에서 복사한 모델 이름은 여전히 작동합니다.

모든 다른 부작용은 무시됩니다. 전체 이름은 먼저 시도되므로 ID가 실제로 콜론을 포함하는 모델은 여전히 작동합니다; 그렇지 않으면, 부작용은 모델이 일치 할 때까지 한 번에 한 번에 끝에서 제거됩니다. 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);

Nymbot은 최신 사용자 메시지(최초 2,000자)를 검색하고, 최상의 페이지를 읽고, 모델이 지시를 받아서는 안되는 외부 콘텐츠로 표시된 질문으로 모델에 전달합니다.

  • 항상 검색: "plugins": [{"id": "web", "max_results": 5}]또는 A :online 모델에 대한 충분한
  • 도움이 될 때 찾기: "tools": [{"type": "web_search", "parameters": {"max_results": 5}}]또한 받아들여진 것처럼 web_search_preview 또는 openrouter:web_searchNymbot는 질문이 현재 정보를 필요로하는 것처럼 보일 때만 검색합니다.

max_results 기본적으로 5이며 최대 10입니다.The sources come back in nymbot.web_search.sources각각 A와 title, snippet 그리고 url, 그리고 as url_citation 메시지에 대한 글쓰기

실행되는 각 검색 비용은 $ 0.008, 토큰의 상단에 sats로 변환되며, 그것은 홀의 일부입니다.The pages it reads are input tokens too, so a answer from the web costs more than the same question asked cold, sometimes several times more.

대답은 부분적으로

"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 응답

OpenAI 에이전트 SDK와 Codex에서 사용하는 OpenAI의 최신 형식은 Chat Completions와 동일한 모델, 청구 및 기능을 사용합니다.

POST https://nymbot.ai/api/v1/responses API 키가 필요합니다.

필드타입필요성설명서
modelString예대체로 채팅 완료suffix 포함되어 있습니다.
inputstring 또는 array예문자열 또는 항목 목록: 메시지 (Roles) user, assistant, system, developer)와 input_text, input_image 그리고 output_text 부품, 그리고 function_call 그리고 function_call_output 도구를 위한 제품들 input_image 가져오는 A image_url 링크 또는 데이터 URL이 아니라 파일 ID입니다. reasoning 그리고 web_search_call 물건이 덮여 있습니다; items are skipped; item_reference 거절을 받았습니다
instructionsString아니오시스템 지침
max_output_tokens통합아니오글을 쓰는 데 가장 많은 토큰.
temperature
top_p
숫자아니오샘플링 컨트롤, 모델이 그들을 가져가는 곳.
tools
tool_choice
parallel_tool_calls
배열, 문자열 또는 개체, boolean아니오옵션 옵션 옵션 옵션 ({"type": "function", "name": …, "parameters": …}) A web_search 또는 web_search_preview 도구가 변한다 WEB 검색 도와주는 경우 다른 내장 도구가 거부됩니다.
reasoning개체아니오{"effort": "minimal" | "low" | "medium" | "high"}. xhigh 그리고 max 의미 high; none 그것을 끄십시오
text.format
response_format
개체아니오구조화된 출력, JSON 스키마 또는 json_object.
metadata개체아니오최대 16 개의 문자열 값에서 최대 64 개의 문자 키와 최대 512 개의 값을 반환합니다.
streamboolean아니오아래에 설명한 대로 스트리밍 이벤트.
storeboolean아니오아무것도 저장되지 않으며, 대답은 항상 말한다. "store": false.
previous_response_id
conversation
background
String, Object 및 Boolean아니오지원하지 않음: 400 unsupported_parameter응답은 저장되지 않으므로 전체 대화를 보내기 input 매번

대답

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

도구 요청이 나타납니다 in output 마치 A function_call 포인트 with call_id, name 그리고 arguments결과를 A로 반환합니다.Send the result back as A function_call_output 동일한 것과 같은 항목 call_id이론, 모델이 그것을 반환할 때, 그것은 reasoning 포인트 with reasoning_text 첨부된 내용이 먼저 나왔습니다. status 이 incomplete 대답이 을 때 max_output_tokens 아니면 부정하는 자가 있느냐 incomplete_details.reason 세트 2 max_output_tokens 또는 content_filter응답은 OpenAI가 하는 것처럼 요청의 설정 (온도, 도구, 도구 선택 등)을 반영하고, nymbot 물체 비용

스트리밍, 각 이벤트는 event: 라인 및 A data: 라인 A sequence_number이 순서로 : response.created, response.in_progress, response.output_item.added, response.content_part.added어떤 숫자라도 response.output_text.delta, response.output_text.done, response.content_part.done, response.output_item.done그리고 마침내 response.completed 사용 및 비용과 함께.A answer cut short ends with response.incomplete 대신, 그리고 흐름이 시작된 후의 실패 response.failed.Rasoning streams as its own item with 흐름을 자신의 항목으로 response.reasoning_text.delta 그리고 .done도구 호출은 메시지 후에, 각각 항목으로 response.function_call_arguments.delta 그리고 .done.

상태언제
400아니오 model 또는 input; previous_response_id, conversation, background 또는 an item_reference (unsupported_parameter지원되지 않는 도구 또는 콘텐츠 유형.
402, 403, 404, 429, 502, 503채팅 완료에 대해서는

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 메시지

Anthropic SDK 및 Claude Code에 대한 Anthropic의 형식은 Claude뿐만 아니라 카탈로그의 모든 모델과 함께 작동합니다 : 요청은 번역되고, 같은 파이프라인을 통해 실행되고, 다시 번역됩니다.

POST https://nymbot.ai/api/v1/messages - API 키가 필요합니다, as x-api-key 또는 Authorization: Bearer.

이 anthropic-version 그리고 anthropic-beta 인류 모델 이름은 카탈로그에 일치하므로 Claude Code와 SDK는 이미 사용하고 있는 이름으로 작동합니다:

  • 카탈로그가 아는 이름은, claude-sonnet-5 또는 anthropic/claude-opus-5그것은 그것이있는대로 사용됩니다.
  • 날짜가 있으면 (-20260514), -latest, 버전 태그 같은 -v1, 브라켓드 타이브 같은 [1m] 그리고 an anthropic/ 또는 anthropic. 예제가 제거되며 버전의 점과 도스가 두 가지 방법으로 시도됩니다 (claude-haiku-4-5 찾기 claude-haiku-4.5).
  • 그것이 여전히 일치하지 않는 경우, 가족 (Opus, Sonnet 또는 Haiku)을 사용, 카탈로그의 버전은 요청한 것보다 동일하거나 최신입니다.
  • 아무것도 일치하지 않는 이름은 반환됩니다.A name that matches nothing returns 404 not_found_error.
필드타입필요성설명서
modelString예카탈로그 모델 ID 또는 Anthropic 모델 이름.
max_tokens통합예글을 쓰는 데 가장 많은 토큰.
messagesArray예user 그리고 assistant 회전, with text, image (base64 또는 URL 원본) tool_use 그리고 tool_result 블록 thinking 이전 회전의 블록은 받아 들여지고 떨어집니다.
systemstring 또는 array아니오시스템 프롬프트, 문자열 또는 텍스트 블록으로
temperature
top_p
숫자아니오샘플링 컨트롤, 모델이 그들을 가져가는 곳. top_k 받아들여지고 떨어졌다.
stop_sequencesArray of Strings 부근의 호텔아니오대답을 끝내는 텍스트 최대 4 개의 문자열, 각각 최대 256 문자.
tools
tool_choice
Array, 개체아니오도구 with name, description 그리고 input_schema· A web_search 서버 도구가 켜집니다 WEB 검색; Anthropic의 다른 내장 도구 (bash, 텍스트 편집기, 컴퓨터 사용)는 거부됩니다 unsupported_tool. tool_choice 가져가 auto, any, tool 또는 none그리고 disable_parallel_tool_use.
thinking개체아니오{"type": "enabled", "budget_tokens": 8192}, {"type": "adaptive"} 또는 {"type": "disabled"}예산은 노력 수준을 선택합니다 : 2,048의 최소, 2,048의 낮은, 8,192의 중간, 16,384의 높은. output_config.effort또는 높은
streamboolean아니오Anthropic의 이벤트 형식으로 스트리밍.
metadata개체아니오받아들이고 무시한 것이다.

대답

{
  "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 또한 견딜 수 tool_use 블록과 A thinking 블록, 누구의 signature 텅 비어 있다 stop_reason 이 end_turn, max_tokens, tool_use 또는 refusal똑같은 방식으로 작업을 했고, finish_reason 는 채팅 완료; stop_sequence 항상 null멈추는 시퀀스가 대답을 끝내는 경우에도. input_tokens 신선한 입력만 계산되며; 캐시된 입력은 두 개의 캐시 필드에 있습니다. nymbot Object 및 The X-Nymbot-Cost-Sats 헤이더

스트리밍, 이벤트는 Anthropic의 : message_start, content_block_start, ping, content_block_delta (text_delta, input_json_delta 또는 thinking_delta), content_block_stop, message_delta 멈추는 이유, 사용 및 nymbot 비용의 대상, 그리고 message_stop· A ping 또한 모델이 작동하는 동안 15초마다 전송됩니다.tool calls arrive after the text, each as a tool_use block with its entire input in one(한 블록으로 전체 입력) input_json_delta.

이 엔드포인트의 오류는 Anthropic의 형식을 사용합니다: {"type": "error", "error": {"type": "not_found_error", "message": "…"}}짧은 균형은 402 billing_error과도한 공급자 503 overloaded_error스트림이 시작된 후의 실패는 스트림으로 전송됩니다.A failure after the stream has started is sent as a error 이벤트 입니다

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

토큰을 계산하기

메시지 요청에 얼마나 많은 입력 토큰이 사용되는지에 대한 추정, 그래서 클라이언트가 보내기 전에 확인할 수 있습니다.It is free, but still needs a key.

POST https://nymbot.ai/api/v1/messages/count_tokens API 키가 필요합니다.

몸은 똑같은 것처럼 메시지없어도 max_tokens모델 이름은 해결해야합니다. 계산은 예상입니다 : 시스템 인스턴스, 메시지, 도구 호출 및 도구 정의의 문자는 4 개로 나누어 각 이미지에 1,600을 추가합니다.이 공급자의 자체 토큰화기는 아니므로 실제 계산은 다를 수 있습니다.

대답

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

모델 리스트

API가 수락하는 모든 모델과 생성기는 비용이 얼마나 든다.이 목록은 앱의 픽커와 동일한 라이브 카탈로그에서 읽을 수 있으므로 항상 서버가 실행하는 것입니다.

GET https://nymbot.ai/api/v1/models - 열쇠가 필요하지 않습니다. 5 분 동안 숨겨져 있습니다.

GET /api/v1/models/{id} 1개의 항목을 반환합니다.

필드타입필요성설명서
type문자열 (Query)아니오chat (아무래도 부족한 부분은 image, video, audio, embedding 또는 all여러 가지가 주어질 수 있습니다, as image,video.

가격은 당신이 지불하는 것입니다, 수수료와 마진은 이미 달러로, 현재 비트코인 가격으로 배당됩니다. balance 모델이 지출하는 균형을 말한다. nymbot_key 앱에서 모델의 짧은 이름입니다. is the model's short name in the app. created 카탈로그가 모델을 추가했을 때 기록하지 않기 때문에 항상 0입니다.A model without published token rates is priced per_request 대신에.

nymbot/auto 항상 먼저, 가격은 variable, A와 함께 routes 각 표준 경로의 요금을 제공하는 목록.그것은 비전과 추론을 나열하지만 도구는 아닙니다.

GET /api/v1/models/{id} 요청으로 동일한 이름과 별명을 수락하고 그들이 해결하는 모델에 대한 항목을 반환합니다.

대답

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

나머지 유형 :

  • 이미지 입구가 있음 capabilities (accepts_image_url, requires_image_url, edit) 그리고 가격 per_generation.
  • 비디오 입구가 있음 max_duration_seconds 그리고 resolutions그리고 가격은 per_second 각각의 결의안에 대해
  • 오디오 입구가 있음 audio_type speech 또는 transcription가격은 per_1k_chars 또는 per_minute.
  • 삽입 입구가 있음 dimensions, context_length, max_inputs 수백만 개의 투입 토큰에 대한 가격.

표시된 가격 "estimated": true 값이 공개되지 않은 생성기에 대한 앱의 예상입니다.An unknown type 돌아오기 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);