> ## 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.

# DeepSeek

> Wrap DeepSeek's OpenAI-compatible API to meter and gate calls with Stigg.

DeepSeek serves its own DeepSeek models. Its API follows OpenAI's format, so you wrap it with the `OpenAI` client and the SDK meters it with the OpenAI recipe.

## Set up

Point the `OpenAI` client's `baseURL` at DeepSeek and wrap it:

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

const deepseek = stigg.wrap(
  new OpenAI({ baseURL: 'https://api.deepseek.com', apiKey: process.env.DEEPSEEK_API_KEY }),
);

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

## What is reported

DeepSeek returns a `usage` object in OpenAI's format with the number of tokens each call consumed. Calls are reported under the `openai.chat.completions.create` event name, with the same metrics as [OpenAI](/documentation/ai-agents/llm-wrappers/providers/openai#what-is-reported).

DeepSeek reports its cache usage in its own fields, `prompt_cache_hit_tokens` and `prompt_cache_miss_tokens`, rather than OpenAI's `cached_tokens`. If the `cached_tokens` metric stays at zero for your DeepSeek traffic, build a meter on `raw.prompt_cache_hit_tokens` to meter cache hits.

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

For details on DeepSeek's API, see DeepSeek's [API docs](https://api-docs.deepseek.com/) and [context caching guide](https://api-docs.deepseek.com/guides/kv_cache/).


## Related topics

- [OpenAI-compatible endpoints](/documentation/ai-agents/llm-wrappers/providers/openai-compatible.md)
- [Supported providers and gateways](/documentation/ai-agents/llm-wrappers/supported-providers.md)
- [Automation flows](/documentation/native-integrations/crm/salesforce/salesforce-create-automation-flows.md)
- [Monetize my product using usage-based pricing](/guides/i-want-to/monetize-my-product-using-usage-based-pricing.md)
- [Bill customers using invoices](/guides/i-want-to/bill-customers-using-invoices.md)


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