> ## Documentation Index
> Fetch the complete documentation index at: https://docs.stigg.io/llms.txt
> Use this file to discover all available pages before exploring further.

# OpenAI-compatible endpoints

> Wrap any provider with an OpenAI-compatible API, such as Together, Fireworks, DeepSeek, xAI, Perplexity or vLLM.

## Set up

Any provider that exposes an OpenAI-compatible API and returns an OpenAI-shaped `usage` block can be wrapped through the `OpenAI` client. Point `baseURL` at the provider and wrap it:

```typescript theme={null}
import OpenAI from 'openai';

const together = stigg.wrap(
  new OpenAI({ baseURL: 'https://api.together.ai/v1', apiKey: process.env.TOGETHER_API_KEY }),
);

await together.chat.completions.create({
  model,
  messages,
  stiggContext: { customerId: 'customer-acme', entitlement: { currencyId: 'credits' } },
});
```

Each of these has its own page with the base URL to use and anything specific to that provider:

<CardGroup cols={2}>
  <Card title="Together AI" href="/documentation/ai-agents/llm-wrappers/providers/together">A large catalog of open-source models</Card>
  <Card title="Fireworks AI" href="/documentation/ai-agents/llm-wrappers/providers/fireworks">Open-source and fine-tuned models</Card>
  <Card title="DeepSeek" href="/documentation/ai-agents/llm-wrappers/providers/deepseek">DeepSeek's own models</Card>
  <Card title="xAI" href="/documentation/ai-agents/llm-wrappers/providers/xai">Grok models</Card>
  <Card title="Perplexity" href="/documentation/ai-agents/llm-wrappers/providers/perplexity">Models with built-in web search</Card>
  <Card title="vLLM" href="/documentation/ai-agents/llm-wrappers/providers/vllm">Self-hosted model server</Card>
</CardGroup>

Any other provider with an OpenAI-compatible API works the same way.

Some providers have their own recipe, which the SDK selects instead of the OpenAI recipe, so their calls are reported under their own event names: [OpenRouter](/documentation/ai-agents/llm-wrappers/providers/openrouter), [LiteLLM Proxy](/documentation/ai-agents/llm-wrappers/providers/litellm) and [Groq](/documentation/ai-agents/llm-wrappers/providers/groq). [Mistral](/documentation/ai-agents/llm-wrappers/providers/mistral) and [Ollama](/documentation/ai-agents/llm-wrappers/providers/ollama) also serve an OpenAI-compatible API: through the `OpenAI` client they are metered as described on this page, and through their own clients with their own recipes.

<Tip>
  Many compatible providers only include usage in a stream when `stream_options: { include_usage: true }` is set. Check one streamed call in Stigg before relying on it.
</Tip>

## What is reported

An OpenAI-compatible provider returns responses in OpenAI's format, including a `usage` object with the number of tokens the call consumed. Not every provider fills in every field, so check the provider's own API docs for what its `usage` object contains, and OpenAI's [Chat Completions reference](https://developers.openai.com/api/reference/resources/chat/subresources/completions/methods/create) for the format itself.

These providers are wrapped through the `OpenAI` client, so usage is reported with the OpenAI recipe: the `openai.chat.completions.create` and `openai.responses.create` event names, and the same metrics as [OpenAI](/documentation/ai-agents/llm-wrappers/providers/openai#what-is-reported). Which of those metrics are filled in depends on what the provider returns in its `usage` block. To tell providers apart in Stigg, add a dimension such as `provider` to the `stiggContext`.

Every usage field the vendor returns is also included, with a `raw.` prefix. See [How usage is reported](/documentation/ai-agents/llm-wrappers/supported-providers#how-usage-is-reported).


## Related topics

- [Mistral](/documentation/ai-agents/llm-wrappers/providers/mistral.md)
- [Perplexity](/documentation/ai-agents/llm-wrappers/providers/perplexity.md)
- [vLLM](/documentation/ai-agents/llm-wrappers/providers/vllm.md)
- [xAI](/documentation/ai-agents/llm-wrappers/providers/xai.md)
- [Together AI](/documentation/ai-agents/llm-wrappers/providers/together.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.