81trust / 100
Llm Claude Sonnet
by claude-sonnet-api in AI models & inference
x402 APIPassing, checked 2 h ago
Claude Sonnet API - pay per call, no API key. OpenAI-format chat completions on anthropic/claude-sonnet-5.5, pinned to Anthropic's own OpenRouter endpoint for reliability. You sign a fixed price computed from your max_tokens; unused tokens are not refunded. 20s server-side timeout - never charged if it fires; set your client timeout to 30s. Try GET /llm/claude-sonnet/sample.
POST https://x402.agentindex.world/llm/claude-sonnet
Last 30 days
All checks passedSome failedAll failedNot checked
- Uptime
- 100%
- Response time
- 170 ms typical, 170 ms slowest 5%
- Last check
- 2 h ago
- Next check
- any minute now
How to call it
# See the payment challenge (nothing is charged)
curl -i -X POST "https://x402.agentindex.world/llm/claude-sonnet" \
-H "content-type: application/json" \
-d '{"max_tokens":150,"messages":[{"content":"Summarize in one sentence: The Eiffel Tower is a wrought-iron lattice tower on the Champ de Mars in Paris, France. It was designed by Gustave Eiffel's engineering company and built as the entrance arch for the 1889 World's Fair. Initially criticized by some of France's leading artists and intellectuals for its design, it has become a global cultural icon of France and one of the most recognizable structures in the world, attracting millions of visitors every year.","role":"user"}]}'import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client().register(
"eip155:8453",
new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);
// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fx402.agentindex.world%2Fllm%2Fclaude-sonnet
const res = await pay("https://x402.agentindex.world/llm/claude-sonnet", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({"max_tokens":150,"messages":[{"content":"Summarize in one sentence: The Eiffel Tower is a wrought-iron lattice tower on the Champ de Mars in Paris, France. It was designed by Gustave Eiffel's engineering company and built as the entrance arch for the 1889 World's Fair. Initially criticized by some of France's leading artists and intellectuals for its design, it has become a global cultural icon of France and one of the most recognizable structures in the world, attracting millions of visitors every year.","role":"user"}]}),
});
console.log(await res.json());Example input
{
"max_tokens": 150,
"messages": [
{
"content": "Summarize in one sentence: The Eiffel Tower is a wrought-iron lattice tower on the Champ de Mars in Paris, France. It was designed by Gustave Eiffel's engineering company and built as the entrance arch for the 1889 World's Fair. Initially criticized by some of France's leading artists and intellectuals for its design, it has become a global cultural icon of France and one of the most recognizable structures in the world, attracting millions of visitors every year.",
"role": "user"
}
]
}Example output
{
"choices": [
{
"finish_reason": "stop",
"index": 0,
"message": {
"content": "The Eiffel Tower, a wrought-iron lattice tower in Paris designed by Gustave Eiffel's company for the 1889 World's Fair, was initially criticized by prominent French artists and intellectuals but has since become a globally recognized cultural icon that draws millions of visitors annually.",
"role": "assistant"
}
}
],
"created": 1790780999,
"id": "gen-1790780999-5D8mNBe2jJJ4gO8UyUsm",
"model": "anthropic/claude-sonnet-5.5",
"object": "chat.completion",
"provider": "Anthropic",
"usage": {
"completion_tokens": 100,
"cost": 0.00132,
"prompt_tokens": 160,
"total_tokens": 260
},
"x402_receipt": {
"latency_ms": 1700,
"model_served": "anthropic/claude-sonnet-5.5",
"price_paid_usdc": 0.001892,
"upstream": "llm/claude-sonnet"
}
}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 | 253 ms | $0.0019 |
| 7 h ago | Passed | 402 | 170 ms | $0.0019 |