---
title: &quot;Use GPT in OpenClaw via RunAPI — LLM API Guide&quot;
url: &quot;https://runapi.ai/openclaw-gpt.md&quot;
canonical: &quot;https://runapi.ai/openclaw-gpt&quot;
locale: &quot;en&quot;
model: &quot;gpt&quot;
---

# Use GPT in OpenClaw.

GPT-5.5 is OpenAI&#39;s flagship LLM, available through RunAPI at half the official per-token price. OpenClaw already speaks the OpenAI completions protocol — point it at RunAPI&#39;s /v1 base URL and every GPT variant (5.5, 5.4, 5.4-mini, 5.3-codex) works with streaming, function calling, and structured output.

## 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;gpt-5.5&quot;,
    &quot;messages&quot;: [
      {&quot;role&quot;: &quot;system&quot;, &quot;content&quot;: &quot;You are a concise coding assistant.&quot;},
      {&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: &quot;Write a Python function that merges two sorted lists in O(n) time.&quot;}
    ],
    &quot;temperature&quot;: 0.3,
    &quot;max_tokens&quot;: 1024
  }&#39;

```

### Response

```json
{
  &quot;id&quot;: &quot;chatcmpl-abc123&quot;,
  &quot;object&quot;: &quot;chat.completion&quot;,
  &quot;model&quot;: &quot;gpt-5.5&quot;,
  &quot;choices&quot;: [
    {
      &quot;index&quot;: 0,
      &quot;message&quot;: {
        &quot;role&quot;: &quot;assistant&quot;,
        &quot;content&quot;: &quot;def merge_sorted(a, b):\n    result = []\n    i = j = 0\n    while i &lt; len(a) and j &lt; len(b):\n        if a[i] &lt;= b[j]:\n            result.append(a[i]); i += 1\n        else:\n            result.append(b[j]); j += 1\n    result.extend(a[i:])\n    result.extend(b[j:])\n    return result&quot;
      },
      &quot;finish_reason&quot;: &quot;stop&quot;
    }
  ],
  &quot;usage&quot;: {
    &quot;prompt_tokens&quot;: 38,
    &quot;completion_tokens&quot;: 95,
    &quot;total_tokens&quot;: 133
  }
}

```

## How it works

1. **Point OpenClaw at RunAPI** — If RunAPI is already configured as a provider in OpenClaw, the same key and /v1 base URL work for GPT. OpenClaw uses the openai-completions API mode, so GPT-5.5 is a drop-in model swap — no protocol change needed.
2. **Select a GPT model** — Set the model to gpt-5.5 for the flagship, gpt-5.4 or gpt-5.4-mini for lower cost, or gpt-5.3-codex for code-heavy tasks. The /v1/chat/completions endpoint returns a standard OpenAI response with usage counts and finish_reason.
3. **Use streaming or function calling** — Add &quot;stream&quot; true for token-by-token SSE output. Add a tools array for function calling. Add response_format for structured JSON output. All standard OpenAI parameters work through RunAPI without modification.

## Parameters

| Parameter | Type | Description |
|-----------|------|-------------|
| `model` | `string` | Required. gpt-5.5, gpt-5.4, gpt-5.4-mini, gpt-5.4-nano, gpt-5.3-codex, or gpt-5.2. |
| `messages` | `array` | Required. Array of message objects with role (system, user, assistant) and content fields. |
| `temperature` | `number` | Optional. Sampling temperature between 0 and 2. Lower values produce more deterministic output. Defaults to 1. |
| `max_tokens` | `integer` | Optional. Maximum number of tokens to generate in the completion. |
| `stream` | `boolean` | Optional. When true, returns server-sent events with incremental token deltas. Defaults to false. |
| `tools` | `array` | Optional. Array of tool definitions for function calling. Each tool has a type, function name, description, and parameters schema. |
| `response_format` | `object` | Optional. Set type to &quot;json_object&quot; or &quot;json_schema&quot; for structured JSON output. |
| `reasoning_effort` | `string` | Optional. Controls thinking depth for supported models. Accepted values are low, medium, high. |

## FAQ

### Can I use GPT-5.5 in OpenClaw through RunAPI?

Yes. OpenClaw supports OpenAI-compatible providers. Add RunAPI with base URL https://runapi.ai/v1 and set the model to gpt-5.5. The openai-completions protocol that OpenClaw already uses works without changes.

### What is the difference between Chat Completions API and the Responses API?

Chat Completions (/v1/chat/completions) is the standard request-response endpoint that returns a message. The Responses API (/v1/responses) is OpenAI&#39;s newer surface that supports built-in web search, file search, and computer use tools. Both are available through RunAPI at the same discounted rate.

### Which GPT model should I use -- 5.5 vs 5.4 vs 5.4-mini vs codex?

GPT-5.5 for complex reasoning and hard problems. GPT-5.4 for everyday tasks at lower cost. GPT-5.4-mini for high-volume cheap work like classification or tagging. GPT-5.3-codex for code generation and editing. All use the same endpoint and parameters.

### How do I use structured outputs to guarantee valid JSON from GPT?

Set response_format to json_schema with a schema definition in your request. GPT will constrain its output to match your schema exactly. This works for data extraction, form parsing, and any task where you need predictable JSON structure. RunAPI forwards the schema parameter unchanged.

### Can I use function calling and structured output with GPT on RunAPI?

Yes. Pass a tools array for function calling or set response_format to json_schema for structured output. RunAPI forwards these parameters to the GPT model and returns the tool_calls or structured JSON in the standard OpenAI response format.


## Links

- [OpenClaw setup guide →](https://runapi.ai/openclaw)
- [GPT on RunAPI →](https://runapi.ai/models/gpt)
- [Model catalog](https://runapi.ai/models)
- [API docs](https://runapi.ai/docs)
