- A vendor the SDK does not support yet.
- Your own models, or an internal AI service with its own client.
- A client you got from somewhere else, such as an open-source library.
wrap(). Everything else, checking before each call and reporting after it, works exactly as it does for the built-in vendors.
Any OpenAI-compatible API
Many vendors expose an API in OpenAI’s format, and support calling it with OpenAI’sopenai client. Any of them that returns an OpenAI-shaped usage block is metered with no recipe at all: point the OpenAI client’s baseURL at the vendor and wrap it.
openai.chat.completions.create and openai.responses.create event names, and the same metrics as OpenAI. Which of those metrics are filled in depends on what the vendor returns in its usage block, so check the vendor’s own API docs. To tell vendors apart in Stigg, add a dimension such as provider to the stiggContext.
Vendors with their own page, such as Together AI, Fireworks AI, DeepSeek, xAI, Perplexity and vLLM, work exactly this way. Some vendors have a recipe of their own, which the SDK selects instead of the OpenAI recipe, so their calls are reported under their own event names: OpenRouter, LiteLLM Proxy, Groq, Cloudflare and Databricks.
For a vendor whose API is not in OpenAI’s format, write a recipe, as described below.
Write a recipe
You can also start from a built-in recipe and change part of it, for example to add an estimate to every method of
anthropicRecipe. See Requested usage for an example.
Use it
Pass the recipe towrap(), then call the client as usual:
stiggContext says which customer the call’s usage is reported for (customerId, required) and, optionally, which credits or metered feature to check before the call (entitlement). The SDK removes it before the call reaches your vendor. See AI agents for every field.
Make one call, then open the customer in the Stigg app and check that a usage event arrived with the metrics you expect.
Contribute your recipe
The Agent SDK is open source under the MIT license, and the built-in recipes are written exactly the way yours is. If you wrote a recipe for a vendor other developers use too, contribute it to the Agent SDK on GitHub. Once it is merged, the SDK recognizes that vendor automatically and no one needs to pass a recipe for it.Usage without a client
Wrapping works when you call a model through a client object. Sometimes there is nothing to wrap: for example, you call a model over plain HTTP, or the usage is not a model call at all, such as a paid web-search API your agent uses. In that case, count the usage yourself and send it to Stigg withstigg.report():
stigg.check(). For a full example, see Actions that are not model calls.
Need a vendor we do not support yet? Let us know.