# claude-opus-4-7 (https://reapi.ai/docs/claude-opus-4-7)

import { Callout } from 'fumadocs-ui/components/callout';
import { Tab, Tabs } from 'fumadocs-ui/components/tabs';

Use **`claude-opus-4-7`** with either reAPI endpoint. Native Anthropic Messages exposes Anthropic's official parameter names and SSE events. Existing OpenAI clients retain Chat Completions and keep tunable `temperature` and `top_p`. Current live rates are published on the [model page](/models/claude-opus-4-7).

| Format                  | Endpoint                                        | Authentication                             |
| ----------------------- | ----------------------------------------------- | ------------------------------------------ |
| Anthropic Messages      | `POST https://api.reapi.ai/v1/messages`         | `x-api-key: YOUR_REAPI_API_KEY`            |
| OpenAI Chat Completions | `POST https://api.reapi.ai/v1/chat/completions` | `Authorization: Bearer YOUR_REAPI_API_KEY` |

Both use your unified reAPI API key and credit balance. reAPI supplies the default Anthropic protocol version automatically; no version header is required. Set `anthropic-beta` on either endpoint when a feature requires it. No automatic retries are performed.

## Native Messages example

```bash
curl --no-buffer https://api.reapi.ai/v1/messages \
  -H "x-api-key: YOUR_REAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "claude-opus-4-7",
    "max_tokens": 4096,
    "temperature": 0.7,
    "messages": [{"role":"user","content":"Review this architecture and list the main trade-offs."}],
    "stream": true
  }'
```

For the Anthropic SDK, set its base URL to `https://api.reapi.ai` (the SDK appends `/v1/messages`) and pass your reAPI API key. Set the SDK's retry count to `0` when you require one attempt per application action.

## Native request parameters

The request body is forwarded without a field allowlist or schema rewriting. Admission checks the model, request size, media URL policy, and output ceiling.

| Field                                                                                                                               | Type                       | Behavior                                                                                                            |
| ----------------------------------------------------------------------------------------------------------------------------------- | -------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| `model`                                                                                                                             | string, required           | `claude-opus-4-7` (or `claude-opus-4-7:GROUP_ID` for an explicit group)                                             |
| `messages`                                                                                                                          | array, required            | Native user/assistant content blocks, images, documents, and tool results                                           |
| `max_tokens`                                                                                                                        | integer, required          | `0`–`128,000`. Zero passes through for cache warmup; upstream determines behavior                                   |
| `system`                                                                                                                            | string or text-block array | Top-level instructions; blocks can carry `cache_control` markers                                                    |
| `stream`                                                                                                                            | boolean                    | Defaults to `false`; `true` returns native SSE ending in `message_stop`                                             |
| `temperature` / `top_p` / `top_k`                                                                                                   | number                     | Tunable sampling controls (live-verified `200` on Messages). Tune either `temperature` or `top_p`, not both         |
| `tools` / `tool_choice`                                                                                                             | array / object             | Native tool definitions (`input_schema`, `strict`, `tool_choice`). Live-verified `tool_use` execution on Messages   |
| `stop_sequences`                                                                                                                    | string array               | Stops generation when a supplied sequence is matched                                                                |
| `cache_control`                                                                                                                     | object or null             | Prompt caching marker (`type: "ephemeral"`, optional `ttl: "5m"` or `"1h"`)                                         |
| `thinking`, `output_config`, `metadata`, `container`, `context_management`, `mcp_servers`, `speed`, `service_tier`, `inference_geo` | object / string            | Forwarded unchanged to the upstream Messages API; acceptance (`200`) alone does not verify every option took effect |

Input images and PDF documents must use public HTTP(S) URLs under reAPI's media policy; base64 payloads and `data:` URIs are rejected.

## Observed channel behavior (2026-11-20)

Direct probes against the upstream Messages endpoint verified:

* Native JSON responses (`max_tokens`, `temperature`, `top_p`), native SSE (`message_start` through `message_stop`), and native tool calling (`tools` with `strict: true` returning `stop_reason: "tool_use"`) succeeded with per-request cost receipts.
* `output_config.effort`, `thinking: {"type": "adaptive"}`, and `output_config.format` (`json_schema`) were accepted with HTTP `200`, but the schema probe returned plain text rather than enforced JSON — validate structured outputs in your application when targeting this model.

## Existing OpenAI clients

<Tabs items={['cURL', 'Python (OpenAI SDK)', 'Node.js', 'Go']}>
  <Tab value="cURL">
    ```bash
    curl --no-buffer https://api.reapi.ai/v1/chat/completions \
      -H "Authorization: Bearer YOUR_REAPI_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{
        "model": "claude-opus-4-7",
        "messages": [
          { "role": "user", "content": "Hello" }
        ],
        "stream": true,
        "max_tokens": 4096,
        "temperature": 0.7
      }'
    ```
  </Tab>

  <Tab value="Python (OpenAI SDK)">
    ```python
    from openai import OpenAI

    client = OpenAI(
        api_key="YOUR_REAPI_API_KEY",
        base_url="https://api.reapi.ai/v1",
    )

    stream = client.chat.completions.create(
        model="claude-opus-4-7",
        messages=[{"role": "user", "content": "Hello"}],
        stream=True,
        max_tokens=4096,
        temperature=0.7,
    )

    for chunk in stream:
        delta = chunk.choices[0].delta.content if chunk.choices else None
        if delta:
            print(delta, end="", flush=True)
    ```
  </Tab>

  <Tab value="Node.js">
    ```js
    import OpenAI from "openai";

    const client = new OpenAI({
      apiKey: "YOUR_REAPI_API_KEY",
      baseURL: "https://api.reapi.ai/v1",
    });

    const stream = await client.chat.completions.create({
      model: "claude-opus-4-7",
      messages: [{ role: "user", content: "Hello" }],
      stream: true,
      max_tokens: 4096,
      temperature: 0.7,
    });

    for await (const chunk of stream) {
      process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
    }
    ```
  </Tab>

  <Tab value="Go">
    ```go
    package main

    import (
        "bytes"
        "encoding/json"
        "fmt"
        "io"
        "net/http"
    )

    func main() {
        body, _ := json.Marshal(map[string]any{
            "model": "claude-opus-4-7",
            "messages": []map[string]string{
                {"role": "user", "content": "Hello"},
            },
            "stream":      true,
            "max_tokens":  4096,
            "temperature": 0.7,
        })
        req, _ := http.NewRequest("POST",
            "https://api.reapi.ai/v1/chat/completions", bytes.NewReader(body))
        req.Header.Set("Authorization", "Bearer YOUR_REAPI_API_KEY")
        req.Header.Set("Content-Type", "application/json")

        resp, _ := http.DefaultClient.Do(req)
        defer resp.Body.Close()
        out, _ := io.ReadAll(resp.Body)
        fmt.Println(string(out))
    }
    ```
  </Tab>
</Tabs>

On `/api/v1/chat/completions`, `temperature`, `top_p`, `stop`, `tools`, `tool_choice`, and `max_tokens` are mapped onto the native Messages path while preserving `message.anthropic_content` (and `anthropic_event` on SSE) for multi-turn state.

## Group selection and pricing

Using the bare model ID `claude-opus-4-7` selects the configured default group (`claude`). To route to another authorized group with the same reAPI API key, pass `claude-opus-4-7:GROUP_ID` in `model`. Discover currently available groups and live prices at:

```http
GET https://api.reapi.ai/v1/models/claude-opus-4-7/groups
```

See [LLM groups](/docs/api/llm-groups) for details. Current per-1M-token rates (input, output, cache read, and cache write) live on the [Claude Opus 4.7 model page](/models/claude-opus-4-7) and in its [machine-readable reference](/models/claude-opus-4-7/llms.txt). Failed or interrupted deliveries are not charged.

## Related

* [Claude Opus 4.7 model page](/models/claude-opus-4-7) — Playground & live rates
* [Claude Opus 4.8](/docs/claude-opus-4-8)
* [Claude Opus 5](/docs/claude-opus-5)
* [LLM groups](/docs/api/llm-groups)
* [Authentication](/docs/api/authentication)
* [Errors catalog](/docs/api/errors)
