Latest
AI News

Perplexity Code Mode Arrives in the Agent API: What Changes for Developers

Perplexity Code Mode lets agents run parallel tool calls in code. Plus GPT-5 shuts down on 11 December and two free models.

Perplexity Code Mode Arrives in the Agent API: What Changes for Developers

Perplexity has added Perplexity Code Mode to its Agent API, letting AI models write small JavaScript programs that call tools in parallel instead of making one tool call at a time. The December 2026 update also switches the API’s higher effort levels to Code Mode by default, and comes alongside two other changes developers need to act on this month: OpenAI’s GPT-5 models shut down on 11 December, and two fast models are free on Perplexity’s Orchestrator API until 15 December.

In this article
  1. What Perplexity Code Mode does
  2. How to turn on Perplexity Code Mode
  3. What developers need to watch
  4. GPT-5 models shut down on 11 December
  5. Two free models until 15 December
  6. Why Perplexity Code Mode matters
  7. FAQ
  8. Sources

Key facts: Code Mode lets the model write a JavaScript program that calls built-in tools, MCP tools and custom functions, which Perplexity then runs. The high, xhigh and ultra effort levels now use Code Mode by default, and developers who want the old behaviour can pin earlier versions. OpenAI’s gpt-5, gpt-5-mini and gpt-5-nano stop working on 11 December 2026.

What Perplexity Code Mode does

Most AI agents work in a loop. The model asks for a tool, waits for the result, reads it, then asks for the next tool. Each round trip adds time and tokens, and the model has to read every raw result even when most of it is useless.

Perplexity Code Mode changes that pattern. According to Perplexity’s API changelog, the model writes a JavaScript program that calls the tools it needs, Perplexity runs the program, and one program can make many tool calls in parallel. The program then sends only the data the model actually needs back into its context. In practice, an agent researching ten companies can search all ten at once and filter the results in code, rather than reading ten full search responses one after another.

When a program stops or runs for longer than 10 seconds, the API response includes a program item and a program_output item, so developers can see what the model wrote and what it returned.

How to turn on Perplexity Code Mode

For custom requests, developers add {"type": "programmatic_tool_calling"} to the tools list, then add programmatic to allowed_callers for each tool that programs are allowed to call. The effort presets handle this automatically.

Effort levelNew defaultWhat changesPin to keep old behaviour
highhigh@2026-12-01.0Code Mode on; sandbox included; web_search, fetch_url and sandbox called only from programs; 40 tool-call limit removed (40-step limit stays)high@2026-11-11.0
xhighxhigh@2026-12-01.0web_search, finance_search and sandbox called only from programs; 300-step limit unchangedxhigh@2026-11-18.0
ultraultra@2026-12-01.0Code Mode and program items enabledNo pinned version named

What developers need to watch

  • Sandbox billing: runs that start a sandbox container are billed for container time, so costs can shift even if token use falls.
  • Search settings move into programs: if a request does not list web_search or fetch_url, settings such as search_type, max_tokens, max_tokens_per_page and max_urls no longer apply, because each program sets its own options.
  • Time Machine conflict: setting snapshot_as_of on web_search returns an HTTP 400 error under Code Mode, including on xhigh and ultra. Teams using Perplexity Time Machine for date-cutoff searches should pin an earlier version.
  • Same model: the model and reasoning effort behind each preset are unchanged; only the way tools are called is different.

Coverage of the launch reported that Code Mode cut benchmark costs by up to 53%. Perplexity’s changelog itself does not give cost or benchmark figures, so teams should measure the effect on their own workloads.

GPT-5 models shut down on 11 December

The changelog also warns that OpenAI shuts down gpt-5, gpt-5-mini and gpt-5-nano on 11 December 2026. Anyone calling openai/gpt-5, openai/gpt-5-mini or openai/gpt-5-nano through Perplexity’s Agent API or Orchestrator API must switch models before that date. Newer options listed in the changelog include openai/gpt-5.6-sol at $5 per million input tokens and $30 per million output tokens, and google/gemini-4-carbon at $4 and $20.

Two free models until 15 December

Perplexity is also running a promotion on its Orchestrator API. perplexity/deepseek-v4.1-flash, newly available with a 262,144-token context window and up to 65,536 output tokens, and perplexity/glm-5.3-flash are billed at $0.00 for input, cached input and output until the end of 15 December 2026. Each API organisation can use 1 million tokens per minute and 5 million tokens per hour on each model, and requests over the limit return a 429 error and are not billed.

Why Perplexity Code Mode matters

Code Mode follows a wider industry shift toward “programmatic tool calling”, where agents batch and filter work in code instead of passing every intermediate result through the model. For research-heavy agents, that can mean faster runs, smaller contexts and fewer wasted tokens. For Perplexity, it strengthens the developer platform it has been building through the Agent API, Orchestrator API, Search API and Context API. Our Perplexity API pricing guide explains how the rates fit together.

FAQ

What is Perplexity Code Mode?

A feature of Perplexity’s Agent API that lets the model write JavaScript programs to call tools in parallel and return only the data it needs.

Is Code Mode on by default?

Yes for the high, xhigh and ultra presets from December 2026. Custom requests turn it on with programmatic_tool_calling.

Can I keep the old behaviour?

Yes. Pin high@2026-11-11.0 or xhigh@2026-11-18.0 to keep direct tool calls.

When do the GPT-5 models stop working?

11 December 2026, for gpt-5, gpt-5-mini and gpt-5-nano.

Sources

Stay Ahead of AI

Get the latest AI news delivered to your inbox.

We don’t spam! Read our privacy policy for more info.

Published

Spotted an error? Read our editorial and corrections policy or email editorial@perplexityaimagazine.com.