We use cookies. Cookies and browser storage keep you signed in and remember your preferences. With your permission we also measure how the site is used. You can any time. See our cookie policy.

Reasoning

Endpoints

Reasoning

Control how much thinking a reasoning model does with the reasoning parameter, and read the reasoning tokens it used in each response.

Try it in the playground

Reasoning models think before they answer: OpenAI GPT-5 and o-series, Claude with extended thinking, Gemini 2.5, DeepSeek R1, Qwen and others. api14 accepts a single reasoning parameter and converts it to each provider's native setting. Reasoning tokens are billed as output tokens.

Request parameters

ParameterTypeDescription
reasoning.effortstring"minimal", "low", "medium" or "high". Used by OpenAI and Grok models, and mapped to a token budget for others.
reasoning.max_tokensintegerAn exact thinking budget in tokens. Used by Anthropic, Gemini and Qwen. Use either this or effort, not both.
reasoning.excludebooleanThe model still reasons, but the reasoning text is left out of the response.
reasoning.enabledbooleanTurn reasoning on with default settings.
include_reasoningbooleanLegacy switch, the same as reasoning: {} or reasoning.exclude: false.
{
  "model": "anthropic/claude-sonnet-4.5",
  "messages": [{ "role": "user", "content": "How many r's are in 'strawberry'? Think carefully." }],
  "reasoning": { "max_tokens": 2000 },
  "max_tokens": 4000
}

max_tokens must be larger than the reasoning budget, because it covers both the thinking and the answer.

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api14.com/api/v1",
  apiKey: process.env.API14_API_KEY,
});

const result = await client.chat.completions.create({
  "model": "openai/gpt-5-mini",
  "messages": [
    {
      "role": "user",
      "content": "Explain vector databases in two sentences."
    }
  ],
  "reasoning": {
    "effort": "high"
  }
});
console.log(result.choices[0].message.content);

Response

The reasoning text is returned in message.reasoning, separate from the answer. Some models also return structured reasoning_details:

{
  "id": "gen-1760000000-think",
  "model": "anthropic/claude-sonnet-4.5",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "content": "There are 3 r's in \"strawberry\".",
        "reasoning": "s-t-r-a-w-b-e-r-r-y: r at position 3, 8 and 9..."
      }
    }
  ],
  "usage": {
    "prompt_tokens": 22,
    "completion_tokens": 312,
    "total_tokens": 334,
    "completion_tokens_details": { "reasoning_tokens": 290 },
    "cost": 0.004746
  }
}

When streaming, reasoning arrives in delta.reasoning chunks before the delta.content chunks.

Notes

  • OpenAI o-series and GPT-5 models don't return their reasoning text, but you still pay for reasoning_tokens.
  • In multi-turn tool use with Claude, send reasoning_details back unchanged in the assistant message so the model can continue its reasoning.
  • Some models (e.g. deepseek/deepseek-r1) always reason. effort doesn't apply to them.
  • Higher effort costs more and takes longer. Watch completion_tokens_details.reasoning_tokens.

Errors

The same as Chat completions. A budget that is too small or too large for a model may return an upstream 400. See Errors.