There is an ongoing outage on the primary CPAN mirror. It is possible to work around the issue by using MetaCPAN as a mirror.

NAME

App::Greple::xlate::gpt5 - GPT-5 translation engine for greple xlate module

SYNOPSIS

greple -Mxlate --xlate-engine=gpt5 --xlate=ja file.txt

DESCRIPTION

This module provides GPT-5 translation support for the App::Greple::xlate module. GPT-5 is OpenAI's latest language model released in 2025, offering enhanced reasoning capabilities and improved translation quality.

GPT-5 API SPECIFICATIONS

Model Variants

GPT-5 is available in three sizes:

  • gpt-5 - Full model with maximum capabilities

  • gpt-5-mini - Smaller, faster variant

  • gpt-5-nano - Minimal variant for lightweight tasks

Token Limits

  • Input limit: 272,000 tokens

  • Output limit: 128,000 tokens (including reasoning tokens)

  • Total context window: 400,000 tokens (272,000 input + 128,000 output)

Input/Output Support

  • Input: Text and images

  • Output: Text only

New API Parameters

GPT-5 introduces several new parameters for fine-grained control:

reasoning_effort

Controls the model's thinking time and reasoning depth:

  • minimal - Minimal reasoning for fast responses, suitable for deterministic tasks

  • low - Low reasoning effort, prioritizes speed

  • medium - Balanced reasoning (default)

  • high - Maximum reasoning effort, prioritizes quality

verbosity

Controls the length and detail of responses:

  • low - Minimal, terse responses

  • medium - Balanced detail level

  • high - Comprehensive, verbose responses

max_completion_tokens

Specifies the maximum number of completion tokens in the response. Unlike the legacy max_tokens parameter, this specifically controls output tokens and is the recommended approach for GPT-5.

Enhanced Features

Reduced Hallucinations

GPT-5 is significantly less likely to hallucinate compared to previous models:

  • 45% fewer factual errors compared to GPT-4o

  • 80% fewer factual errors compared to OpenAI o3 when reasoning is enabled

Custom Tools Support

GPT-5 supports custom tools that can receive plaintext payloads instead of JSON, enabling more flexible integration with external systems.

Context-Free Grammar (CFG)

Allows strict output constraints to match predefined syntax rules, useful for ensuring valid format generation.

Pricing (2025)

GPT-5 Series

  • gpt-5: $1.25/1M input tokens, $10/1M output tokens

  • gpt-5-mini: $0.25/1M input tokens, $2/1M output tokens

  • gpt-5-nano: $0.05/1M input tokens, $0.40/1M output tokens

  • Cached input: $0.125/1M tokens (90% discount on cached input tokens)

GPT-4 Series (for comparison)

  • gpt-4.1: $2.00/1M input tokens, $8.00/1M output tokens (1M token context)

  • gpt-4.1-mini: $0.40/1M input tokens, $1.60/1M output tokens (1M token context)

  • gpt-4.1-nano: $0.10/1M input tokens, $0.40/1M output tokens (1M token context)

  • gpt-4o: $3.00/1M input tokens, $10.00/1M output tokens

  • gpt-4o-mini: $0.15/1M input tokens, $0.60/1M output tokens

  • gpt-4o with audio: $5/1M input tokens, $20/1M output tokens (text), $100/1M input tokens, $200/1M output tokens (audio)

Note: GPT-4.1 models feature 1,000,000 token context window and prompt caching (25% input cost for cached prefixes).

GPT-4.1 is approximately 26% cheaper than GPT-4o for median queries.

GPT-4o represents an 83% price drop for output tokens and 90% drop for input tokens compared to original GPT-4.

CONFIGURATION

This module uses the following default parameters:

  • engine: gpt-5

  • temperature: 1 (fixed for GPT-5)

  • max_length: 3000 characters per batch

  • reasoning_effort: minimal (for translation tasks)

  • max_completion_tokens: 4000

ENVIRONMENT VARIABLES

  • OPENAI_API_KEY - Required OpenAI API key

  • XLATE_DEBUG - Enable debug output

  • XLATE_MAXLEN - Override maximum batch length

DEPENDENCIES

SEE ALSO

AUTHOR

Kazumasa Utashiro

LICENSE

Copyright 2024-2025 Kazumasa Utashiro.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.