---
title: &quot;RunAPI 経由で OpenClaw で DeepSeek を使う — 生成AI API ガイド&quot;
url: &quot;https://runapi.ai/ja/openclaw-deepseek.md&quot;
canonical: &quot;https://runapi.ai/ja/openclaw-deepseek&quot;
locale: &quot;ja&quot;
model: &quot;deepseek&quot;
---

# OpenClaw で DeepSeek を使う。

DeepSeek V4 は RunAPI を通じて OpenAI 互換と Anthropic 互換の両プロトコルに対応します。スピードには Flash、品質には Pro。組み込みの推論モードはリクエストパラメータで有効化されます——別のモデルスラッグは不要です。RunAPI は DeepSeek トークンを公式の DeepSeek 料金の 50% で価格設定します。

## 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 as provider** — Set the RUNAPI_API_KEY environment variable. In OpenClaw, add RunAPI as an OpenAI-compatible provider with baseUrl https://runapi.ai/v1. DeepSeek works through the same provider you use for GPT or Claude — no separate provider entry needed.
2. **Select a DeepSeek model** — Set the model to deepseek-v4-pro for quality or deepseek-v4-flash for speed. Both use the /v1/chat/completions endpoint. To enable reasoning, pass thinking.type set to enabled — no model slug change required.
3. **Stream the response** — OpenClaw receives the response as an SSE stream in OpenAI chat completions format. Token usage is reported in the final event for billing transparency. The same format works whether you use DeepSeek, GPT, or Claude through RunAPI.

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

### How do I switch from OpenAI to DeepSeek -- is it really a drop-in replacement?

Yes. DeepSeek V4 supports the OpenAI chat completions format. Point OpenClaw at RunAPI&#39;s /v1 base URL, change the model parameter to deepseek-v4-pro or deepseek-v4-flash, and the rest of your config stays the same. No code changes beyond the model name.

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

### What is the difference between deepseek-v4-flash and deepseek-v4-pro?

Flash prioritizes speed with lower latency and cost. Pro prioritizes quality with better performance on complex reasoning, coding, and multi-step tasks. Both use the same endpoint and accept the same parameters.

### Does RunAPI route DeepSeek requests through China?

No. RunAPI proxies DeepSeek through its own infrastructure. Your requests do not route through Chinese data centers, and your API key is never shared with DeepSeek directly.

### How does DeepSeek pricing on RunAPI compare to direct DeepSeek API pricing?

RunAPI prices DeepSeek tokens at 50% of official DeepSeek rates. DeepSeek is already one of the lowest-cost LLM providers, so through RunAPI you get the lowest per-token price available for a reasoning-capable model. Billing is per-token with no subscription or minimum spend.


## Links

- [OpenClaw セットアップガイド →](https://runapi.ai/ja/openclaw)
- [DeepSeek モデル →](https://runapi.ai/ja/models/deepseek)
- [Model catalog](https://runapi.ai/ja/models)
- [API docs](https://runapi.ai/ja/docs)
