Chat Completions
by x402.orthogonal.com in AI models & inference
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.
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
Reliability
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
| Parameter | Type | Required | Description |
|---|---|---|---|
add_generation_prompt | boolean | No | If true, applies the model's generation prompt template. Usually needed for chat models. |
add_special_tokens | boolean | No | If true, adds special tokens (like BOS) to the input. Default: true. |
bad | string | No | Words or phrases the model should avoid generating. Passed as a string. |
bad_token_ids | array | No | Array of token IDs that should never appear in the output. |
best_of | number | No | Number of candidate completions to generate server-side, returning the best. Currently only supports 1. |
chat_template | string | No | Custom Jinja2 template for formatting the conversation. Overrides the model's default chat template. |
chat_template_args | object | No | Additional arguments passed to the chat template as template variables. |
disaggregated_params | object | No | Advanced parameters for distributed inference. Only relevant for disaggregated serving configurations. |
documents | array | No | Array of document objects for retrieval-augmented generation (RAG). Each document has content the model can reference when responding. |
early_stopping | boolean | No | In beam search, stop as soon as the required number of complete candidates are found. |
echo | boolean | No | If true, prepends the last input message to the generated output. |
frequency_penalty | number | No | Penalize tokens based on how often they've appeared so far. Range -2.0 to 2.0. Positive values reduce repetition. Default: 0. |
ignore_eos | boolean | No | If true, the model continues generating past the end-of-sequence token. |
include_stop_str_in_output | boolean | No | If true, includes the stop string in the generated output rather than trimming it. |
length_penalty | number | No | Penalty applied during beam search. Values > 1.0 favor longer sequences, < 1.0 favor shorter ones. |
logit_bias | object | No | Map of token IDs to bias values (-100 to 100). Increase or decrease the likelihood of specific tokens appearing in the output. |
logprobs | boolean | No | If true, returns the log probabilities of each output token in the response. |
max_tokens | number | No | Maximum number of tokens to generate in the response. Default is 4096. |
messages | array | No | Array 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_p | number | No | Minimum probability threshold. Tokens below this probability relative to the most likely token are filtered out. |
min_tokens | number | No | Minimum number of tokens to generate before any stop condition can trigger. |
model | string | No | Model 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), … |
n | number | No | Number of completions to generate. Currently only supports 1. |
parallel_tool_calls | boolean | No | Whether the model can make multiple tool calls in parallel in a single response. Default: true. |
presence_penalty | number | No | Penalize 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_effort | string | No | Controls 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_penalty | number | No | Multiplicative penalty for repeated tokens. Values > 1.0 discourage repetition, < 1.0 encourage it. |
response_format | object | No | Constrain 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. |
seed | number | No | Integer for deterministic sampling. Same seed with same parameters should return the same result. Not guaranteed across model versions. |
skip_special_tokens | boolean | No | If 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 --decodeJavaScript: 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
| When | Result | HTTP | Time | Price |
|---|---|---|---|---|
| 2 h ago | Passed | 402 | 868 ms | $0.005 |
| 6 h ago | Passed | 402 | 262 ms | $0.005 |
| 10 h ago | Passed | 402 | 440 ms | $0.005 |
| 14 h ago | Passed | 402 | 387 ms | $0.005 |
| 19 h ago | Passed | 402 | 411 ms | $0.005 |
Show 10 older checks
| 23 h ago | Passed | 402 | 328 ms | $0.005 |
| 27 h ago | Passed | 402 | 410 ms | $0.005 |
| 30 h ago | Passed | 402 | 288 ms | $0.005 |
| 34 h ago | Passed | 402 | 459 ms | $0.005 |
| 38 h ago | Passed | 402 | 475 ms | $0.005 |
| 42 h ago | Passed | 402 | 594 ms | $0.005 |
| 46 h ago | Passed | 402 | 380 ms | $0.005 |
| 2 days ago | Passed | 402 | 266 ms | $0.005 |
| 2 days ago | Passed | 402 | 253 ms | $0.005 |
| 2 days ago | Passed | 402 | 337 ms | $0.005 |