77trust / 100

Chat Completions

by x402.orthogonal.com in AI models & inference

x402 APIPassing, checked 2 h ago

Send a conversation to a model and get a completion back. Works exactly like the OpenAI chat completions endpoint. Pass messages and a model slug, get a response with the assistant's reply. Supports streaming for real-time token delivery, tool calling for function execution, structured outputs via response_format, and controllable reasoning depth on supported models. | ERROR: Unable to calculate price.

POST
https://x402.orthogonal.com/baseten/v1/chat/completions
Price
$0.005
per call in USDC
Uptime
100%
last 30 days
Response time
387 ms
594 ms slowest 5%
Last check
Passed
2 h ago, next any minute now

Run a free test callHow to call it

Reliability

All checks passedSome failedAll failedNot checked

Status and outage history · Atom feed

How to call it

POST https://x402.orthogonal.com/baseten/v1/chat/completions

Each call costs $0.005 in USDC on Base, paid with the request over x402.

Run a free test callOne unpaid request, the way an agent sends it. You see the payment challenge it gets back. Nothing is charged.

Example request

From the listing.

POST https://x402.orthogonal.com/baseten/v1/chat/completions
content-type: application/json

{
  "messages": [],
  "model": "model"
}

Parameters

ParameterTypeRequiredDescription
add_generation_promptbooleanNoIf true, applies the model's generation prompt template. Usually needed for chat models.
add_special_tokensbooleanNoIf true, adds special tokens (like BOS) to the input. Default: true.
badstringNoWords or phrases the model should avoid generating. Passed as a string.
bad_token_idsarrayNoArray of token IDs that should never appear in the output.
best_ofnumberNoNumber of candidate completions to generate server-side, returning the best. Currently only supports 1.
chat_templatestringNoCustom Jinja2 template for formatting the conversation. Overrides the model's default chat template.
chat_template_argsobjectNoAdditional arguments passed to the chat template as template variables.
disaggregated_paramsobjectNoAdvanced parameters for distributed inference. Only relevant for disaggregated serving configurations.
documentsarrayNoArray of document objects for retrieval-augmented generation (RAG). Each document has content the model can reference when responding.
early_stoppingbooleanNoIn beam search, stop as soon as the required number of complete candidates are found.
echobooleanNoIf true, prepends the last input message to the generated output.
frequency_penaltynumberNoPenalize tokens based on how often they've appeared so far. Range -2.0 to 2.0. Positive values reduce repetition. Default: 0.
ignore_eosbooleanNoIf true, the model continues generating past the end-of-sequence token.
include_stop_str_in_outputbooleanNoIf true, includes the stop string in the generated output rather than trimming it.
length_penaltynumberNoPenalty applied during beam search. Values > 1.0 favor longer sequences, < 1.0 favor shorter ones.
logit_biasobjectNoMap of token IDs to bias values (-100 to 100). Increase or decrease the likelihood of specific tokens appearing in the output.
logprobsbooleanNoIf true, returns the log probabilities of each output token in the response.
max_tokensnumberNoMaximum number of tokens to generate in the response. Default is 4096.
messagesarrayNoArray of message objects, each with a 'role' (system, user, assistant, tool) and 'content' (string or array of content parts). This is the conversation history sent to the model.
min_pnumberNoMinimum probability threshold. Tokens below this probability relative to the most likely token are filtered out.
min_tokensnumberNoMinimum number of tokens to generate before any stop condition can trigger.
modelstringNoModel slug to run inference against. Available models: deepseek-ai/DeepSeek-V3-0324 (164k context, reasoning), deepseek-ai/DeepSeek-V3.1 (164k context, reasoning), zai-org/GLM-4.6 (200k context, reasoning), zai-org/GLM-4.7 (200k context, reasoning), moonshotai/Kimi-K2-Instruct-0905 (128k context), …
nnumberNoNumber of completions to generate. Currently only supports 1.
parallel_tool_callsbooleanNoWhether the model can make multiple tool calls in parallel in a single response. Default: true.
presence_penaltynumberNoPenalize tokens based on whether they've appeared at all. Range -2.0 to 2.0. Positive values encourage the model to explore new topics. Default: 0.
reasoning_effortstringNoControls thinking depth for reasoning models. Options: 'low', 'medium', 'high'. Default: 'medium'. Higher effort uses more tokens but produces more thorough reasoning. Supported on DeepSeek V3/V3.1, GLM 4.6/4.7, and Kimi K2 Thinking.
repetition_penaltynumberNoMultiplicative penalty for repeated tokens. Values > 1.0 discourage repetition, < 1.0 encourage it.
response_formatobjectNoConstrain the output format. Use {"type": "json_object"} for JSON mode, or {"type": "json_schema", "json_schema": {"name": "...", "schema": {...}}} for structured outputs with a specific schema.
seednumberNoInteger for deterministic sampling. Same seed with same parameters should return the same result. Not guaranteed across model versions.
skip_special_tokensbooleanNoIf true, special tokens are removed from the output text. Default: true.

And 14 more.

Example response

The listing has no example response.

Call it from code

The curl command shows the payment challenge. The JavaScript and Python versions pay and call, and never pay more than $0.005.

curl: see the payment challenge
# bash or zsh: see the payment challenge. Nothing is charged.
curl -sS -g -i -X POST 'https://x402.orthogonal.com/baseten/v1/chat/completions' \
  -H 'content-type: application/json' \
  --data-raw '{"messages":[],"model":"model"}'

# x402 v2 sends the challenge base64-encoded in the PAYMENT-REQUIRED header (v1 sends it in the body).
# To read the header:
curl -sS -g -o /dev/null -D - -X POST 'https://x402.orthogonal.com/baseten/v1/chat/completions' \
  -H 'content-type: application/json' \
  --data-raw '{"messages":[],"model":"model"}' \
  | grep -i '^payment-required:' | cut -d' ' -f2 | tr -d '\r' | base64 --decode
JavaScript: pay and call
// npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

// Pays at most $0.005 per call.
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.005" });
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? ToolVet checks it first for $0.005. Pay for that from a separate
// client: this one is capped at $0.005 per payment. GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fx402.orthogonal.com%2Fbaseten%2Fv1%2Fchat%2Fcompletions&method=POST
const res = await pay("https://x402.orthogonal.com/baseten/v1/chat/completions", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({
    "messages": [],
    "model": "model"
  }),
});
console.log(res.status, await res.text());
Python: pay and call
# pip install "x402[requests,evm]"
import os
from eth_account import Account
from x402 import x402ClientSync
from x402.http.clients import x402_requests
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client

# Pays at most $0.005 per call.
client = x402ClientSync().set_spend_controls({"max_amount_per_payment": "$0.005"})
register_exact_evm_client(client, EthAccountSigner(Account.from_key(os.environ["EVM_PRIVATE_KEY"])))

with x402_requests(client) as session:
    res = session.post(
        "https://x402.orthogonal.com/baseten/v1/chat/completions",
        json={
            "messages": [],
            "model": "model",
        },
    )
    print(res.status_code, res.text)

Security scan

No findings

We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
2 h agoPassed402868 ms$0.005
6 h agoPassed402262 ms$0.005
10 h agoPassed402440 ms$0.005
14 h agoPassed402387 ms$0.005
19 h agoPassed402411 ms$0.005
Show 10 older checks
23 h agoPassed402328 ms$0.005
27 h agoPassed402410 ms$0.005
30 h agoPassed402288 ms$0.005
34 h agoPassed402459 ms$0.005
38 h agoPassed402475 ms$0.005
42 h agoPassed402594 ms$0.005
46 h agoPassed402380 ms$0.005
2 days agoPassed402266 ms$0.005
2 days agoPassed402253 ms$0.005
2 days agoPassed402337 ms$0.005