We're sorry but this app doesn't work properly without JavaScript enabled. Please enable it to continue.

This lesson's interactive features are locked, please to keep using them

Temperature

Prompting matters, but model settings can matter too. If your agent acts too chaotic, too verbose, or too eager to wander off into weird ideas, the prompt itself might not be the problem.

Nearly all LLM providers support settings that control the model's behavior outside the prompt itself. One of the most common is "temperature."

Lower temperature (closer to 0.0) means:

  • More focused responses
  • Less randomness

Higher temperature (closer to 1.0) means:

  • More variety and "creativity" (scare quotes intended)
  • Less control over the output

There are some developers who get really deep into knob-turning, which is why we expose these config options for them. But personally I don't really mess with temperature at all when coding.

Don't Overtune

I know you think you've graduated from "Software Engineer" to "AI Engineer," but spending hours tweaking temperature is not time well spent, especially when the next model update might completely change your favorite settings.

So, use the defaults unless you have a clear problem that's best addressed by changing temperature.

Set temperature on the provider, model, or variant. DeepSeek ignores temperature in thinking mode, so this model-level override for DeepSeek V4.1 Flash Free also disables thinking:

{
  "$schema": "https://opencode.ai/config.json",
  "providers": {
    "opencode": {
      "models": {
        "deepseek-v4.1-flash-free": {
          "body": {
            "reasoning_effort": "none",
            "temperature": 0.1,
          },
        },
      },
    },
  },
}

These request fields depend on the provider, not every provider supports every setting.

Assignment

Compare Sloperator slogans at two temperatures.

  1. Tell OpenCode to update the model field in opencode.jsonc if needed; that needs to be set to a model that supports temperature.

  2. If you're using DeepSeek, also set body.reasoning_effort to "none" for this exercise.

Tell OpenCode to run and submit the CLI tests from the project root.

After submitting, go back to your preferred model and default temperature. Also remove the body.reasoning_effort override, if you added it.