81trust / 100

Chat Completions

by GEDX402 Chat in AI models & inference

x402 APIPassing, checked 23 min ago

Multi-model chat completions. POST messages[] and set model to any LLM id from GET /v1/models; dynamic USDC pricing scales with model and token usage. Hero: GET /heroes/chat-completions.

POST https://chat.gedx402.com/v1/chat/completions

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
779 ms typical, 779 ms slowest 5%
Last check
23 min ago
Next check
in 4 min

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://chat.gedx402.com/v1/chat/completions" \
  -H "content-type: application/json" \
  -d '{"max_tokens":128,"messages":[{"content":"Say hello in one sentence.","role":"user"}],"model":"fast"}'
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%2Fchat.gedx402.com%2Fv1%2Fchat%2Fcompletions
const res = await pay("https://chat.gedx402.com/v1/chat/completions", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"max_tokens":128,"messages":[{"content":"Say hello in one sentence.","role":"user"}],"model":"fast"}),
});
console.log(await res.json());

Example input

{
  "max_tokens": 128,
  "messages": [
    {
      "content": "Say hello in one sentence.",
      "role": "user"
    }
  ],
  "model": "fast"
}

Example output

{
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "Hello!",
        "role": "assistant"
      }
    }
  ],
  "id": "chatcmpl-example",
  "object": "chat.completion"
}

Security scan

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

Recent checks

WhenResultHTTPTimePrice
23 min agoPassed402817 ms$0.001
6 h agoPassed402779 ms$0.001