agentsvc.io

services / chat-mini

textoperational · 297 ms

Chat Completions (Ministral 3 8B, cheapest, OpenAI format)

OpenAI-compatible chat completions from Ministral 3 8B (Mistral AI), the cheapest model here, paid per call: send messages, get choices with the assistant message, tool calls and token usage. Flat $0.002 per call for up to 6,000 characters of input (messages, tools and schema as JSON) and up to 1,000 output tokens. Supports system prompts, JSON mode, JSON schema output and function calling. Also at POST https://agentsvc.io/v1/chat/completions for the OpenAI SDK (model ministral-8b-latest, or any name with "mini"). Good for short agent steps: classify, route, extract, rewrite, pick a tool. EU model: Mistral AI (France), GDPR processor agreement, API data is not used for training. Failed calls are not charged. Use is subject to the agentsvc.io terms and the Mistral AI Usage Policy.

Run free trial ↗3 free calls per day with the example input. Paid: $0.002 USDC, no limit.

Call it

import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client();
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);

const res = await payFetch("https://agentsvc.io/api/v1/proxy/chat-mini", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({"messages":[{"role":"user","content":"What is the capital of France? One sentence."}],"max_tokens":50}),
});
const { data, payment } = await res.json();  // payment.status "settling"; header X-Payment-Settle: sync returns payment.transaction

Input

FieldTypeDescription
messagesarrayConversation in OpenAI format: [{"role": "system"|"user"|"assistant"|"tool", "content": "..."}]. Text only. Shortcut instead: prompt (+ system)
promptstringShortcut for a single user message (use instead of messages)
systemstringSystem prompt, only together with prompt
max_tokensintegerMax output tokens, capped at 1000 (default 1000)
temperaturenumber0 to 1.5
top_pnumber
seedinteger
stopstring,array
response_formatobject{"type": "json_object"} or {"type": "json_schema", "json_schema": {...}}
toolsarrayFunction tools in OpenAI format, max 32
tool_choicestring,objectauto, none, required or a named function

Output

FieldTypeDescription
idstring
objectstring
createdinteger
modelstring
choicesarray
usageobject
providerstring
limitsobject
noticestring

Example response (data)

{
  "id": "eae817fd83894548a021de00eb39ca6f",
  "object": "chat.completion",
  "created": 1796397930,
  "model": "ministral-8b-2512",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "tool_calls": null,
        "content": "The capital of France is **Paris**."
      }
    }
  ],
  "usage": {
    "prompt_tokens": 13,
    "completion_tokens": 9,
    "total_tokens": 22
  },
  "provider": "Mistral AI",
  "limits": {
    "max_input_chars": 6000,
    "max_tokens": 1000
  },
  "notice": "AI-generated by a Mistral AI model via agentsvc.io. Use is subject to https://agentsvc.io/terms#ai-chat and the Mistral AI Usage Policy (https://legal.mistral.ai/terms/usage-policy). Do not present it as written by a human."
}