---
title: &quot;RunAPI 経由で Hermes Agent で Claude を使う — 生成AI API ガイド&quot;
url: &quot;https://runapi.ai/ja/hermes-claude.md&quot;
canonical: &quot;https://runapi.ai/ja/hermes-claude&quot;
locale: &quot;ja&quot;
model: &quot;claude&quot;
---

# Hermes Agent で Claude を使う。

Anthropic Claude は、最大の能力（200K コンテキスト、拡張思考）のための Opus 4.8、バランスの取れたパフォーマンスのための Sonnet 4.6、スピードのための Haiku 4.5 を提供します。Hermes Agent は custom:runapi プロバイダー経由で Anthropic 公式のトークン単価の 50% で Claude を呼び出します——チャット用に設定したのと同じキーと base_url を使用します。

## 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;claude-opus-4.8&quot;,
    &quot;max_tokens&quot;: 1024,
    &quot;messages&quot;: [
      {&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: &quot;Explain the difference between a mutex and a semaphore in three sentences.&quot;}
    ]
  }&#39;

```

### Response

```json
{
  &quot;id&quot;: &quot;chatcmpl-abc123&quot;,
  &quot;object&quot;: &quot;chat.completion&quot;,
  &quot;model&quot;: &quot;claude-opus-4.8&quot;,
  &quot;choices&quot;: [
    {
      &quot;index&quot;: 0,
      &quot;message&quot;: {
        &quot;role&quot;: &quot;assistant&quot;,
        &quot;content&quot;: &quot;A mutex is a locking mechanism that allows only one thread to access a resource at a time...&quot;
      },
      &quot;finish_reason&quot;: &quot;stop&quot;
    }
  ],
  &quot;usage&quot;: {
    &quot;prompt_tokens&quot;: 24,
    &quot;completion_tokens&quot;: 87,
    &quot;total_tokens&quot;: 111
  }
}

```

## How it works

1. **Configure RunAPI** — Set the RUNAPI_API_KEY environment variable. If you already added RunAPI as a custom:runapi provider in Hermes Agent, the same key and base_url work for Claude — switch the model parameter to claude-opus-4.8 in your Hermes config or use the /model command.
2. **Call Claude** — Send a POST request to /v1/chat/completions with model set to claude-opus-4.8. Include a messages array with at least one user message. Set max_tokens to control response length. Add &quot;stream&quot; true for token-by-token SSE output in your Hermes session.
3. **Read the response** — The endpoint returns the assistant message synchronously — no task polling needed. Hermes Agent displays the response inline. Token usage counts are included in the response for billing transparency. Streaming responses arrive as SSE events for real-time display.

## Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `model` | `string` | Required. claude-opus-4.8, claude-sonnet-4.6, claude-haiku-4.5, or any Claude variant listed in the RunAPI catalog. |
| `messages` | `array` | Required. Array of message objects with role (system, user, assistant) and content fields. |
| `max_tokens` | `integer` | Maximum number of tokens in the response. Defaults vary by model — set explicitly for predictable billing. |
| `stream` | `boolean` | When true, returns server-sent events with incremental token deltas instead of a single JSON response. |
| `temperature` | `float` | Sampling temperature between 0 and 1. Lower values produce more deterministic output. |
| `top_p` | `float` | Nucleus sampling cutoff. Alternative to temperature — use one or the other, not both. |

## FAQ

### Can I call Claude from Hermes Agent through RunAPI?

Yes. Configure RunAPI as a custom:runapi provider in Hermes Agent with base_url https://runapi.ai/v1 and api_mode chat_completions. Set model to claude-opus-4.8 or any other Claude variant. The same RUNAPI_API_KEY handles chat, image, video, and music models.

### How much does the Claude API actually cost with prompt caching?

RunAPI charges 50% of Anthropic&#39;s official rate. Opus 4.8 is $7.50/$37.50 per million input/output tokens through RunAPI versus $15/$75 direct. With prompt caching enabled, cached input tokens cost even less. No subscription or volume commitment required.

### Does switching between Claude models require reconfiguring Hermes Agent?

No. Change only the model parameter in your Hermes config or use the /model command during a session. The custom:runapi provider, base_url, and API key stay the same across all Claude variants -- Opus 4.8, Sonnet 4.6, Haiku 4.5, and dated snapshots.

### Can I use the native Anthropic Messages API from Hermes Agent?

RunAPI exposes both /v1/chat/completions (OpenAI-compatible, used by Hermes Agent&#39;s chat_completions mode) and /v1/messages (native Anthropic format). The native endpoint supports extended thinking and Anthropic-specific features. For Hermes Agent, the OpenAI-compatible path covers standard chat and streaming.

### How do I use prompt caching to reduce Claude API costs?

Include a cache_control breakpoint on your system prompt or large context blocks. Subsequent requests that share the same cached prefix pay a reduced input token rate. This is especially effective for agent loops where the system prompt and tool definitions repeat across many turns.

### Can Hermes Agent use Claude&#39;s extended thinking mode through RunAPI?

Yes. Pass the extended thinking parameters in your request body. Hermes Agent forwards them to the RunAPI Claude endpoint, which supports the same extended thinking configuration as the direct Anthropic API.


## Links

- [Hermes Agent セットアップガイド →](https://runapi.ai/ja/hermes-agent)
- [Claude モデル →](https://runapi.ai/ja/models/claude)
- [Model catalog](https://runapi.ai/ja/models)
- [API docs](https://runapi.ai/ja/docs)
