Skip to content
Free$1 of credit for every new organization
All articles

Product

Anthropic-compatible endpoint, page text in search, and spend controls

Three parts of Usefully worth knowing about: the /v1/messages endpoint for Anthropic SDKs, full page text in search results, and per-key limits with low-balance alerts.

· 3 min read · Usefully team


This post rounds up three features that people often discover late, and that save real work once you know about them.

1. The Anthropic-compatible endpoint

Usefully's main API is OpenAI-compatible, but if your code is written against Anthropic's Messages API, you don't need to change it. POST /v1/messages accepts Anthropic-format requests, and the official Anthropic SDKs work by changing the base URL and key. The SDK adds /v1/messages itself, so the base URL is the host without /v1.

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  baseURL: "https://api.usefully.info",
  apiKey: process.env.USEFULLY_API_KEY,
});

const msg = await client.messages.create({
  model: "anthropic/claude-sonnet-5-5",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Summarize the CAP theorem in two sentences." }],
});

Requests on this endpoint get the same routing, failover, logging and billing as everything else. A few Anthropic beta features aren't priced on Usefully yet; those are refused with a clear 400 unsupported_feature error rather than billed incorrectly.

2. Full page text in search results

Web search results include a title, URL, snippet and, when known, the published date. For many uses, snippets aren't enough to answer from. Add include_content and each result also carries the page's main text, in the same call, so a RAG pipeline doesn't need a separate fetch step.

curl https://api.usefully.info/v1/search \
  -H "Authorization: Bearer $USEFULLY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query": "rust async runtime comparison", "num_results": 5, "include_content": true,
       "include_domains": ["github.com", "docs.rs"]}'

Domain filters (include_domains, exclude_domains) and freshness combine with it. Search uses the same key and balance as models, and shows up in the same Logs.

3. Spend controls

Prepaid credits already cap total spend at your balance. Two more controls keep that balance from disappearing unexpectedly:

  • Per-key limits. Each key can have a requests-per-minute limit, a tokens-per-minute limit and a daily spend limit in dollars. A key that hits its daily limit gets 429 daily_spend_limit_reached until midnight UTC; other keys keep working.
  • Low-balance alerts. Choose a threshold in Billing, and owners and billing members get an email when the balance drops below it, with time to top up before requests start failing.

Together with spend by day, key and model in the dashboard, these make it hard for a runaway loop or a leaked key to cause a large surprise. For a suggested setup, read per-key budgets for production and staging.

Also worth knowing

  • The playground in the dashboard lets you try any model before writing code.
  • A model whose provider isn't connected returns an error that suggests another model, so a typo or an unavailable model is easy to diagnose.
  • GET /v1/models lists every model with its pricing and context window, and needs no key.

Choosing between the two APIs

If you're starting fresh, the OpenAI-compatible API is the simplest choice: one request format for every model, including Anthropic's, and the widest support in frameworks and tools. Use /v1/messages when you have existing Anthropic SDK code, or depend on Anthropic-specific request fields. Both draw on the same balance, appear in the same Logs, and get the same failover, so you can use each where it fits, even in the same app.

When to ask for page text

Page text makes each search result larger, so ask for it when you'll actually send the text to a model. For a list of links shown to a user, or for deciding which pages are worth reading, snippets are enough and keep responses small.

Everything here is in the API reference. Feedback and feature requests are welcome at support@usefully.info.

More articles

Get started

Your first request is five minutes away.

  • $1 of free credit to start
  • No card, no subscription
  • Keep the SDK you already use
  • Real people at support@usefully.info
Anthropic-compatible endpoint, page text in search, and spend controls · Usefully