openai/gpt-5.4 πŸ“β“πŸ–ΌοΈπŸ”’ β†’ πŸ“

⭐ Official ▢️ 37.6K runs πŸ“… Mar 2026 βš™οΈ Cog 0.16.12
image-analysis image-to-text text-generation

About

OpenAI's most capable frontier model for complex professional work, coding, and multi-step reasoning.

Example Output

Prompt:

"Write a simulation of The Odyssey by Homer in Go"

Output

Here’s a self-contained Go program that simulates the main episodes of The Odyssey as a narrative/resource-based journey.

package main

import (
	"flag"
	"fmt"
	"math/rand"
	"strings"
	"time"
)

type Event struct {
	Name string
	Run  func(*State, *rand.Rand)
}

type State struct {
	Day              int
	Crew             int
	Ships            int
	Supplies         int
	Morale           int
	AthenaFavor      int
	PoseidonWrath    int
	Cunning          int
	Strength         int
	Treasure         int
	Suitors          int
	KnowsWayHome     bool
	AtIthaca         bool
	PenelopeReunited bool
	Alive            bool
}

func main() {
	var seed int64
	flag.Int64Var(&seed, "seed", time.Now().UnixNano(), "random seed")
	flag.Parse()

	rng := rand.New(rand.NewSource(seed))

	state := State{
		Day:           0,
		Crew:          600,
		Ships:         12,
		Supplies:      500,
		Morale:        75,
		AthenaFavor:   40,
		PoseidonWrath: 0,
		Cunning:       95,
		Strength:      82,
		Treasure:      0,
		Suitors:       108,
		Alive:         true,
	}

	events := []Event{
		{"The Cicones", cicones},
		{"The Lotus-Eaters", lotusEaters},
		{"Polyphemus the Cyclops", cyclops},
		{"Aeolus and the Bag of Winds", aeolus},
		{"The Laestrygonians", laestrygonians},
		{"Circe", circe},
		{"The Underworld", underworld},
		{"The Sirens", sirens},
		{"Scylla and Charybdis", scyllaAndCharybdis},
		{"The Cattle of Helios", helios},
		{"Calypso", calypso},
		{"The Phaeacians", phaeacians},
		{"Ithaca in Disguise", ithaca},
		{"The Bow and the Suitors", suitors},
	}

	fmt.Println("THE ODYSSEY: A SMALL GO SIMULATION")
	fmt.Println(strings.Repeat("=", 72))
	fmt.Printf("Seed: %d

", seed)
	fmt.Println("Odysseus leaves ruined Troy with twelve ships, many companions,")
	fmt.Println("and a single goal: home.
")
	printStatus(state)

	for i, e := range events {
		if !state.Alive {
			break
		}
		fmt.Printf("
[%02d] %s
", i+1, e.Name)
		fmt.Println(strings.Repeat("-", 72))
		e.Run(&state, rng)
		printStatus(state)
	}

	fmt.Println("
" + strings.Repeat("=", 72))
	if state.Alive && state.AtIthaca && state.PenelopeReunited && state.Suitors == 0 {
		fmt.Println("Odysseus endures. The wanderer is home, the hall is cleansed,")
		fmt.Println("and the song can rest.")
	} else if state.Alive {
		fmt.Println("Odysseus survives, but his tale remains unfinished.")
	} else {
		fmt.Println("The sea wins. This is not the ending Homer sang.")
	}
}

func printStatus(s State) {
	location := "at sea"
	if s.AtIthaca {
		location = "Ithaca"
	}
	crewText := fmt.Sprintf("%d", s.Crew)
	if s.Crew == 0 {
		crewText = "0 (Odysseus alone)"
	}

	fmt.Printf(
		"Status: day=%d | location=%s | crew=%s | ships=%d | supplies=%d | morale=%d | Athena=%d | Poseidon=%d | treasure=%d | suitors=%d
",
		s.Day, location, crewText, s.Ships, s.Supplies, s.Morale, s.AthenaFavor, s.PoseidonWrath, s.Treasure, s.Suitors,
	)
}

func cicones(s *State, rng *rand.Rand) {
	s.advance(4)

	loot := 25 + rng.Intn(26)
	cost := 20
	lost := s.loseCrew(15 + rng.Intn(21))
	s.addSupplies(loot - cost)
	s.addMorale(-5)

	fmt.Println("At Ismarus, Odysseus sacks the city of the Cicones.")
	fmt.Println("He urges a quick departure, but his men linger over plunder and wine.")
	fmt.Printf("At dawn the Cicones counterattack; %d companions fall before the ships escape.
", lost)
	fmt.Printf("Supplies change by %+d as loot and losses balance out.
", loot-cost)
}

func lotusEaters(s *State, rng *rand.Rand) {
	s.advance(3)
	s.addSupplies(-10)
	s.addMorale(-2)

	tempted := minInt(s.Crew, 2+rng.Intn(4))
	fmt.Printf("%d scouts taste the lotus and forget their longing for home.
", tempted)
	fmt.Println("Odysseus drags them weeping back to the ships and orders an immediate departure.")
}

func cyclops(s *State, rng *rand.Rand) {
	s.advance(5)

	cheese := 10 + rng.Intn(11)
	lost := 6 + rng.Intn(4)
	if s.Cunning < 90 {
		lost += 2
	}
	lost = s.loseCrew(lost)

	s.addSupplies(cheese)
	s.addMorale(-8)
	s.addPoseidon(45)
	s.addAthena(5)

	fmt.Println("Curiosity leads Odysseus into the cave of Polyphemus.")
	fmt.Println(`There he gives the Cyclops wine, names himself "Nobody," and blinds the giant.`)
	fmt.Println("The men escape by clinging beneath the bellies of sheep.")
	fmt.Printf("%d men are eaten or crushed before the escape.
", lost)
	fmt.Println("But Odysseus boasts his true name from the ship, and Poseidon's anger awakens.")
}

func aeolus(s *State, rng *rand.Rand) {
	s.advance(32)

	s.addSupplies(-25)
	s.addMorale(-12)
	s.addPoseidon(10)

	fmt.Println("Aeolus, master of winds, gifts Odysseus a leather bag containing every storm but the west wind.")
	fmt.Println("Ithaca is nearly in sight when the exhausted crew suspects hidden treasure.")
	fmt.Println("They open the bag. The winds burst free. Home vanishes behind them in a gale.")
}

func laestrygonians(s *State, rng *rand.Rand) {
	s.advance(2)

	shipsLost := 0
	if s.Ships > 1 {
		shipsLost = s.loseShips(s.Ships - 1)
	}

	survivorsTarget := 40 + rng.Intn(11)
	lostCrew := 0
	if s.Crew > survivorsTarget {
		lostCrew = s.loseCrew(s.Crew - survivorsTarget)
	}

	s.addSupplies(-60)
	s.addMorale(-20)

	fmt.Println("At the harbor of the Laestrygonians, giants rise instead of hosts.")
	fmt.Println("They hurl boulders like pebbles and spear sailors like fish.")
	fmt.Printf("%d ships are smashed. %d companions die. Only Odysseus's ship escapes.
", shipsLost, lostCrew)
}

func circe(s *State, rng *rand.Rand) {
	s.advance(365)

	turned := minInt(s.Crew, 6+rng.Intn(5))
	feast := 60 + rng.Intn(21)

	s.addSupplies(feast)
	s.addMorale(15)
	s.addAthena(10)

	fmt.Printf("On Aeaea, Circe turns %d men into swine before Hermes arms Odysseus with moly.
", turned)
	fmt.Println("Odysseus forces a truce, wins back his men, and remains in dangerous comfort for a year.")
	fmt.Printf("The island restores some strength; supplies increase by %d.
", feast)
}

func underworld(s *State, rng *rand.Rand) {
	s.advance(4)

	s.KnowsWayHome = true
	s.addMorale(-10)
	s.addAthena(15)

	fmt.Println("Odysseus sails to the edge of the world and speaks with the dead.")
	fmt.Println("Tiresias warns him to leave the cattle of Helios untouched if he hopes to see Ithaca again.")
	fmt.Println("He also hears grief from his mother, glory from Achilles, and ruin from Agamemnon.")
}

func sirens(s *State, rng *rand.Rand) {
	s.advance(1)

	if s.Cunning >= 90 {
		s.addMorale(3)
		fmt.Println("Wax seals the sailors' ears. Odysseus is lashed upright to the mast.")
		fmt.Println("He hears the Sirens sing of knowledge and fame, but the ship rows on.")
		return
	}

	lost := s.loseCrew(3)
	s.addMorale(-5)
	fmt.Printf("The Sirens' song nearly wrecks the voyage; %d men are lost in the confusion.
", lost)
}

func scyllaAndCharybdis(s *State, rng *rand.Rand) {
	s.advance(1)

	lost := s.loseCrew(minInt(6, s.Crew))
	s.addMorale(-12)
	s.addSupplies(-10)

	fmt.Println("Odysseus chooses the lesser evil: better Scylla than the devouring whirlpool.")
	fmt.Printf("As the ship hugs the cliff, Scylla snatches %d men from the deck.
", lost)
}

func helios(s *State, rng *rand.Rand) {
	s.advance(30)

	s.addSupplies(-40)
	s.addMorale(-15)

	if s.Crew == 0 {
		fmt.Println("No crew remains to offend Helios, but fate presses on all the same.")
		return
	}

	lostCrew := s.Crew
	s.Crew = 0
	s.Ships = 0
	s.Supplies = 0
	s.addPoseidon(5)

	fmt.Println("Storm-bound on Thrinacia, the starving crew waits while Odysseus prays apart.")
	fmt.Println("Against every warning, they slaughter the sacred cattle of Helios.")
	fmt.Println("When they sail again, Zeus answers with a thunderbolt.")
	fmt.Printf("The ship is destroyed and all %d remaining companions perish. Odysseus alone survives.
", lostCrew)
}

func calypso(s *State, rng *rand.Rand) {
	s.advance(365 * 7)

	s.addAthena(20)
	s.addPoseidon(-10)
	s.addMorale(-5)

	fmt.Println("For seven years Calypso keeps Odysseus on Ogygia, offering comfort and immortality.")
	fmt.Println("He chooses the pain of mortality and home instead.")
	fmt.Println("At Athena's urging, the gods command his release; even then Poseidon sends one last storm.")
	fmt.Println("Odysseus reaches shore alive, worn down but unbeaten.")
}

func phaeacians(s *State, rng *rand.Rand) {
	s.advance(2)

	gift := 100 + rng.Intn(51)
	s.Treasure += gift
	s.AtIthaca = true
	s.addMorale(30)

	fmt.Println("The Phaeacians receive the stranger kindly and ask for his story.")
	fmt.Println("At last Odysseus tells the whole long tale of his wanderings.")
	fmt.Printf("They honor him with treasure worth %d and carry him sleeping to Ithaca's shore.
", gift)
}

func ithaca(s *State, rng *rand.Rand) {
	s.advance(5)

	s.addAthena(10)

	fmt.Println("Athena cloaks Odysseus in the shape of an old beggar.")
	fmt.Println("He finds the loyal swineherd Eumaeus, reunites with Telemachus, and plans in silence.")
	fmt.Println("In his own hall, the suitors feast on his wealth and mock the stranger before them.")
}

func suitors(s *State, rng *rand.Rand) {
	s.advance(1)

	if !s.AtIthaca {
		s.Alive = false
		fmt.Println("Far from Ithaca, even Odysseus cannot string the bow of his own house.")
		return
	}

	battleScore := s.Cunning + s.Strength + s.AthenaFavor + rng.Intn(20)
	if battleScore < 170 {
		s.Alive = false
		fmt.Println("The plan fails, the hall erupts, and fate turns against the king.")
		return
	}

	slain := s.Suitors
	s.Suitors = 0
	s.PenelopeReunited = true
	s.addMorale(40)

	fmt.Println("Odysseus takes up the great bow no other man can string.")
	fmt.Println("He sends an arrow clean through the axeheads and then into Antinous.")
	fmt.Printf("With Telemachus and a handful of loyal allies, he kills all %d suitors.
", slain)
	fmt.Println("Penelope tests him with the secret of their marriage bed and knows him at last.")
}

func (s *State) advance(days int) {
	s.Day += days
}

func (s *State) loseCrew(n int) int {
	if n < 0 {
		return 0
	}
	if n > s.Crew {
		n = s.Crew
	}
	s.Crew -= n
	return n
}

func (s *State) loseShips(n int) int {
	if n < 0 {
		return 0
	}
	if n > s.Ships {
		n = s.Ships
	}
	s.Ships -= n
	return n
}

func (s *State) addSupplies(delta int) {
	s.Supplies = maxInt(0, s.Supplies+delta)
}

func (s *State) addMorale(delta int) {
	s.Morale = clampInt(s.Morale+delta, 0, 100)
}

func (s *State) addAthena(delta int) {
	s.AthenaFavor = clampInt(s.AthenaFavor+delta, 0, 100)
}

func (s *State) addPoseidon(delta int) {
	s.PoseidonWrath = clampInt(s.PoseidonWrath+delta, 0, 100)
}

func minInt(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func maxInt(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func clampInt(v, lo, hi int) int {
	if v < lo {
		return lo
	}
	if v > hi {
		return hi
	}
	return v
}

Run it

go run main.go

Or with a fixed seed for repeatable results:

go run main.go -seed 42

If you want, I can also make this into:

  • an interactive text game
  • a turn-based strategy sim
  • a terminal animation
  • or a more historically/literarily accurate simulation with Books 1–24

Performance Metrics

142.82s Prediction Time
142.86s Total Time
All Input Parameters
{
  "prompt": "Write a simulation of The Odyssey by Homer in Go",
  "messages": [],
  "verbosity": "medium",
  "image_input": [],
  "reasoning_effort": "high"
}
Input Parameters
prompt Type: string
The prompt to send to the model. Do not use if using messages.
messages Type: arrayDefault:
A JSON string representing a list of messages. For example: [{"role": "user", "content": "Hello, how are you?"}]. If provided, prompt and system_prompt are ignored.
verbosity Default: medium
Constrains the verbosity of the model's response. Lower values will result in more concise responses, while higher values will result in more verbose responses. Currently supported values are low, medium, and high. GPT-5 supports this parameter to help control whether answers are short and to the point or long and comprehensive.
image_input Type: arrayDefault:
List of images to send to the model
system_prompt Type: string
System prompt to set the assistant's behavior
reasoning_effort Default: none
Constrains effort on reasoning for GPT-5.4. Supported values are none, low, medium, high, and xhigh. The default none provides fast, low-latency responses similar to GPT-4.1 in speed. Higher reasoning efforts produce more thorough answers but use more tokens and take longer. For higher reasoning efforts you may need to increase your max_completion_tokens to avoid empty responses (where all the tokens are used on reasoning).
max_completion_tokens Type: integer
Maximum number of completion tokens to generate. For higher reasoning efforts you may need to increase your max_completion_tokens to avoid empty responses (where all the tokens are used on reasoning).
Output Schema

Output

Type: array β€’ Items Type: string

Example Execution Logs
No sid
Model variant: gpt-5.4
Input token count: 16
Output token count: 11991
 - Reasoning tokens: 8615
Total token count: 12007
TTFT: 0.34s
Version Details
Version ID
93f5c5874511c8a825662232dab00841870bd1d5c8adfcc83db393688508be09
Version Created
March 5, 2026
Run on Replicate β†’