---
title: &quot;Use DeepSeek in Hermes Agent via RunAPI — LLM API Guide&quot;
url: &quot;https://runapi.ai/hermes-deepseek.md&quot;
canonical: &quot;https://runapi.ai/hermes-deepseek&quot;
locale: &quot;en&quot;
model: &quot;deepseek&quot;
---

# Use DeepSeek in Hermes Agent.

DeepSeek V4 supports both OpenAI chat completions and Anthropic messages protocols through RunAPI. Hermes Agent connects via the custom:runapi provider — same base URL and key you use for other models. Activate reasoning mode with a request parameter. RunAPI prices DeepSeek at 50% of official rates.

## API example

```bash
curl -X POST https://runapi.ai/v1/chat/completions \
  -H &quot;Authorization: Bearer $RUNAPI_API_KEY&quot; \
  -H &quot;Content-Type: application/json&quot; \
  -d &#39;{
    &quot;model&quot;: &quot;deepseek-v4-pro&quot;,
    &quot;messages&quot;: [
      {&quot;role&quot;: &quot;system&quot;, &quot;content&quot;: &quot;You are a helpful coding assistant.&quot;},
      {&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: &quot;Write a Python function that finds the longest palindromic substring in O(n) time using Manacher algorithm.&quot;}
    ],
    &quot;stream&quot;: true,
    &quot;max_tokens&quot;: 4096
  }&#39;

```

### Response

```json
{
  &quot;id&quot;: &quot;chatcmpl-abc123&quot;,
  &quot;object&quot;: &quot;chat.completion&quot;,
  &quot;model&quot;: &quot;deepseek-v4-pro&quot;,
  &quot;choices&quot;: [
    {
      &quot;index&quot;: 0,
      &quot;message&quot;: {
        &quot;role&quot;: &quot;assistant&quot;,
        &quot;content&quot;: &quot;Here is Manacher&#39;s algorithm implementation...&quot;
      },
      &quot;finish_reason&quot;: &quot;stop&quot;
    }
  ],
  &quot;usage&quot;: {
    &quot;prompt_tokens&quot;: 42,
    &quot;completion_tokens&quot;: 356,
    &quot;total_tokens&quot;: 398
  }
}

```

## How it works

1. **Configure RunAPI provider** — Set the RUNAPI_API_KEY environment variable. If you already added RunAPI as custom:runapi in Hermes Agent, the same provider and key work for DeepSeek — no extra configuration. If not, add RunAPI with base_url https://runapi.ai/v1 and api_mode chat_completions.
2. **Select a DeepSeek model** — Switch the model to deepseek-v4-pro for quality or deepseek-v4-flash for speed. Both use the /v1/chat/completions endpoint through the custom:runapi provider. Enable reasoning by passing thinking.type set to enabled — no separate model entry needed.
3. **Stream the response** — Hermes Agent receives the response as an SSE stream in OpenAI chat completions format. Token usage appears in the final event. Switch between DeepSeek, GPT, and Claude models without changing the provider config — only the model field changes.

## Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `model` | `string` | Required. deepseek-v4-pro or deepseek-v4-flash. |
| `messages` | `array` | Required. Array of message objects with role (system, user, assistant) and content fields. |
| `stream` | `boolean` | Optional. Set to true for SSE streaming. Default false. |
| `max_tokens` | `integer` | Optional. Maximum number of tokens to generate. |
| `temperature` | `number` | Optional. Sampling temperature between 0 and 2. Lower values are more deterministic. |
| `thinking` | `object` | Optional. Set type to &quot;enabled&quot; to activate DeepSeek&#39;s built-in reasoning mode. |

## FAQ

### Can Hermes Agent use DeepSeek through the existing RunAPI provider?

Yes. If you already have custom:runapi configured in Hermes Agent, switch the model to deepseek-v4-pro or deepseek-v4-flash. The base URL, API key, and api_mode stay the same. Use hermes model or edit the config file directly.

### What are thinking tokens in DeepSeek and how do they affect cost?

When you enable reasoning (thinking.type set to enabled), DeepSeek generates additional &quot;thinking&quot; tokens that show its chain-of-thought process. These tokens count as output tokens and are billed accordingly. They improve accuracy on complex tasks but increase total token usage.

### Should I self-host DeepSeek or use the API -- what is the break-even point?

Self-hosting requires significant GPU infrastructure (80GB+ VRAM for the full model). Through RunAPI at 50% of DeepSeek&#39;s already low rates, most teams save money on the API until they hit very high sustained volume. Start with the API and evaluate self-hosting once your monthly token spend justifies the hardware cost.

### How do I activate reasoning mode for DeepSeek in Hermes Agent?

Pass thinking.type set to enabled in the request body. Reasoning mode is a request parameter, not a separate model. The reasoning tokens are billed as output tokens. This works through both the OpenAI and Anthropic protocol surfaces.

### How does DeepSeek pricing on RunAPI compare to using DeepSeek directly?

RunAPI prices DeepSeek tokens at 50% of official DeepSeek rates. Since DeepSeek already undercuts GPT and Claude on per-token cost, this makes it the lowest-priced reasoning-capable LLM available through a single API. No subscription, no minimum — pay per token.

### How does Hermes Agent choose between DeepSeek&#39;s OpenAI and Anthropic protocol modes?

Configure the provider type in Hermes Agent. Use the OpenAI-compatible provider for chat completions format, or the Anthropic-compatible provider for messages format. Both route through RunAPI to the same DeepSeek models.

### Can Hermes Agent switch between DeepSeek Flash, Full, and Reasoner per request?

Yes. Set the model parameter in each request to the desired variant. Hermes Agent can route quick tasks to Flash and complex reasoning to Reasoner, all through the same custom:runapi provider and API key.


## Links

- [Hermes Agent setup guide →](https://runapi.ai/hermes-agent)
- [DeepSeek models →](https://runapi.ai/models/deepseek)
- [Model catalog](https://runapi.ai/models)
- [API docs](https://runapi.ai/docs)
