How to Run GPT-6.2 Astra and Sol APIs in Coding Agents

Want to use the GPT-6.2 API in your coding agents? Learn the Astra and Sol model IDs, the Responses API calls, and how to run them as a team.

Ryan Mitchell

Ryan Mitchell

20 November 2026

How to Run GPT-6.2 Astra and Sol APIs in Coding Agents

The GPT-6.2 API exposes two models, gpt-6.2-astra and gpt-6.2-sol, both with a 1,050,000-token context window and 128,000 max output tokens. Call them through the Responses API, because tool calling requires it. Start at reasoning.effort: "medium", never send none, and put reusable instructions in a developer message so prompt caching works.

OpenAI released GPT-6.2 Astra and GPT-6.2 Sol on November 17, 2026. Astra is the model OpenAI calls its most capable for hard projects. Sol is the everyday model, described on its model page as built for “powering agents at scale.”

Most guides stop at a single request. This one goes further: how to call the GPT-6.2 API, which changes break an agent loop you built for GPT-6.1, how to wire file edits through the apply_patch tool, and how to run several API-backed coding agents as one team with Sharkly.

What the GPT-6.2 API gives you

Both models accept text and images, return text, and run on the same endpoints. The differences are price and knowledge cutoff. Here is what the Sol model page and Astra model page list as of November 20, 2026.

GPT-6.2 Astra GPT-6.2 Sol
Model ID gpt-6.2-astra gpt-6.2-sol
Context window 1,050,000 tokens 1,050,000 tokens
Max input / max output 922,000 / 128,000 922,000 / 128,000
Input / cached input / output (per 1M) $8 / $0.40 / $40 $2 / $0.10 / $10
Knowledge cutoff May 18, 2026 June 1, 2026
Endpoints Responses, Chat Completions, Batch Responses, Chat Completions, Batch
Not supported Realtime, Assistants, fine-tuning Realtime, Assistants, fine-tuning

Two pricing rules matter for coding agents. A request with more than 272K input tokens pays double for input and 1.5 times for output on the whole request. Batch costs 50 percent of standard rates, which suits evals and bulk jobs but not an interactive agent.

The Responses API tool list covers what a coding agent needs: apply_patch, shell, code_interpreter, file_search, web_search, mcp, computer_use, skills, and tool_search. Function calling and structured outputs work too.

How to call the GPT-6.2 API

Five steps get you from zero to a working request:

  1. Create an API key in the OpenAI dashboard and export it as OPENAI_API_KEY.
  2. Install or update the official openai SDK for your language.
  3. Set model to gpt-6.2-sol for everyday work or gpt-6.2-astra for the hard tasks.
  4. Set reasoning.effort to medium for a new integration.
  5. Put reusable instructions in a developer message at the start of input.
from openai import OpenAI

client = OpenAI()  # reads OPENAI_API_KEY

AGENT_RULES = (
    "You are a coding agent working in a Python service. "
    "Keep changes scoped to the task. Report any file or tool you could not reach."
)

response = client.responses.create(
    model="gpt-6.2-sol",
    reasoning={"effort": "medium"},
    input=[
        {"role": "developer", "content": AGENT_RULES},
        {"role": "user", "content": "Explain why test_refund_rounding fails on amounts like 10.005."},
    ],
)

print(response.output_text)
print(response.usage.input_tokens, response.usage.output_tokens)

Print usage from the first day. Agents resend their whole context every turn, so token counts tell you sooner than a bill does which tasks cost the most.

Which reasoning effort should a coding agent use?

OpenAI’s reasoning guide lists low, medium, high, xhigh, and max as possible values, with support varying by model. GPT-6.2 Astra and Sol reject none. If your old code sends none or minimal, switch to low.

Effort Use it for
low Execution-heavy work: renames, small fixes, drafting
medium The default for agentic coding and planning
high Hard debugging and deep planning
xhigh / max Long runs and code review, only when your evals show a gain

You can also raise effort mid-conversation. Add a configuration_update item before the next user message instead of changing the request-level setting, which keeps the prompt prefix intact for caching.

GPT-6.2 API changes that break agent loops

The GPT-6.2 migration guide lists changes that look small but hit agent harnesses hard. Check each one before you swap the model ID.

  • Tool calling needs the Responses API. Chat Completions still answers, but it will not run tools on GPT-6.2.
  • Some sampling parameters are gone. Omit temperature, top_p, and top_logprobs in Responses requests.
  • Top-level instructions now come after input. Reusable rules belong in a developer message as the first input item, or they miss the cache.
  • Edits to history drop reasoning. If you rewrite an earlier developer message or tool output mid-conversation, change models, or downgrade, the API discards earlier reasoning items. Quality can fall and the model may redo work, burning tokens.
  • Flex processing is out. GPT-6.2 does not support service_tier: flex. For long jobs, use background mode with a two-hour or eight-hour completion window, now in public beta.

The prefix rule hurts most. Many harnesses trim or rewrite old tool output to save context. With GPT-6.2, that rewrite costs you the model’s earlier reasoning. Append new items, keep the prefix unchanged, and pass back every output item (reasoning included) or use previous_response_id.

Build a coding-agent loop with apply_patch

A coding agent is a loop: the model proposes an action, your code runs it, and the result goes back. The apply_patch guide defines the file-editing half. The model returns apply_patch_call items, each one a create_file, update_file, or delete_file operation with a V4A diff. Your harness applies it and answers with apply_patch_call_output.

The GPT-6.2 API agent loop: the model returns apply_patch and function calls, the harness applies the diff and runs tests, and the results go back through previous_response_id until the model answers in text.

Here is a minimal loop that edits files and runs tests through one function tool:

import json
import subprocess

from openai import OpenAI

from harness import apply_v4a  # your own diff applier; returns (ok, message)

client = OpenAI()

TOOLS = [
    {"type": "apply_patch"},
    {
        "type": "function",
        "name": "run_tests",
        "description": "Run the project's test suite and return the tail of the output.",
        "parameters": {"type": "object", "properties": {}, "additionalProperties": False},
    },
]


def run_tests() -> str:
    proc = subprocess.run(["pytest", "-q"], capture_output=True, text=True, timeout=600)
    return f"exit={proc.returncode}\n{proc.stdout[-4000:]}"


response = client.responses.create(
    model="gpt-6.2-sol",
    reasoning={"effort": "medium"},
    tools=TOOLS,
    input=[
        {"role": "developer", "content": "Fix the failing test. List anything you could not run."},
        {"role": "user", "content": "test_refund_rounding fails. Find the cause and fix it."},
    ],
)

for turn in range(12):
    results = []
    for item in response.output:
        if item.type == "apply_patch_call":
            ok, message = apply_v4a(item.operation)
            results.append({
                "type": "apply_patch_call_output",
                "call_id": item.call_id,
                "status": "completed" if ok else "failed",
                "output": message,
            })
        elif item.type == "function_call" and item.name == "run_tests":
            results.append({
                "type": "function_call_output",
                "call_id": item.call_id,
                "output": run_tests(),
            })
    if not results:
        break
    response = client.responses.create(
        model="gpt-6.2-sol",
        reasoning={"effort": "medium"},
        tools=TOOLS,
        previous_response_id=response.id,
        input=results,
    )

print(response.output_text)

Three details keep this loop honest. Return status: "failed" with a readable message when a patch does not apply, so the model can recover. Cap the turns, because a confused agent will patch forever. And keep the tool list identical on every call, so the model can keep editing.

For shell access, the shell tool runs either in an OpenAI-hosted container or in a local runtime you execute yourself. OpenAI’s shell guide is blunt about the local option: sandbox it, allowlist commands, and log every call.

One more check belongs in your final prompt. OpenAI reported that both GPT-6.2 models were more likely than earlier models to leave out obstacles that blocked their work, as we covered in the GPT-6.2 Codex guide. Ask the agent to list what it could not run, and read the test log before you trust a green summary.

Astra or Sol for API-driven agents

Default to Sol. It costs a quarter of Astra per token and shares the same context window. Promote a task to Astra when it crosses services, has no clear finish line, or Sol fails the same kind of task twice.

Rate limits do not decide this for you. Both models share one table: 1,000,000 tokens per minute on the Build tier, rising to 40,000,000 on Grow. Several agents on one project key share that pool, which we broke down in GPT-6.2 rate limits.

Run GPT-6.2 API agents as a team in Sharkly

One script on one laptop is easy. Five agents across three Computers, each with its own key, model, and effort setting, is where drift starts. Sharkly runs the coding agents you already use as Agents on your own Computers, so the model choice and the key live in one place your team can see.

The shortest path to the GPT-6.2 API inside Sharkly goes through Codex. Codex can sign in with an API key instead of a ChatGPT plan, and then it bills at standard API rates. On each Computer, log Codex in once:

printenv OPENAI_API_KEY | codex login --with-api-key

Then open the Codex Agent in Sharkly and set its Model row to gpt-6.2-sol or gpt-6.2-astra. Per the Agents docs, the row lists the models the Runtime reports and adds a thinking-depth choice when the model publishes one. When you assign a single Task, you can override the model for that run only.

Be careful where the key goes. Agent settings also take environment variables, injected into the agent process at start. The panel itself says those values are plaintext settings visible to Agent managers, not secret storage. Keep the key in the Computer’s own Codex login, and use a key from a dedicated OpenAI project with a spend limit.

The Environment Variables block in Sharkly Agent settings, which notes that values are injected into the agent process at start and are plaintext settings, not secret storage

Then set Max concurrency (assigned tasks) on each Agent to what your tier’s tokens per minute can carry. Extra Tasks wait in the queue instead of colliding into 429 errors. Agents that pull repositories give each Task its own Git worktree, so parallel runs never share a checkout. Our model routing guide for Crews shows how to write the Sol-by-default, Astra-by-decision rule down for the whole team.

Conclusion

The GPT-6.2 API is easy to call and easy to misuse. Use the Responses API, send medium effort, keep reusable rules in a developer message, and never rewrite the history your agent already sent. Build the edit loop on apply_patch, cap its turns, and ask for unreported blockers in every final answer.

When one agent turns into five, connect a Computer to Sharkly, sign Codex in with your API key, set one Agent to gpt-6.2-sol with a concurrency of 2, and assign it a small bug from your backlog.

FAQ

What is the GPT-6.2 API model name?

Use gpt-6.2-astra for the most capable model and gpt-6.2-sol for everyday work. Both IDs work on the Responses, Chat Completions, and Batch endpoints.

How much does the GPT-6.2 API cost?

Per million tokens, Astra costs $8 input, $0.40 cached input, and $40 output. Sol costs $2, $0.10, and $10. Requests over 272K input tokens pay double for input and 1.5 times for output.

Does GPT-6.2 support function calling in Chat Completions?

Both models answer Chat Completions requests, but OpenAI’s migration guide says tool calling requires the Responses API. Build agents on Responses.

Why does GPT-6.2 reject my reasoning effort setting?

GPT-6.2 Astra and Sol reject reasoning.effort: "none". Use low for fast, execution-heavy work and medium as the default.

What is the GPT-6.2 API context window?

1,050,000 tokens, with up to 922,000 input tokens and 128,000 output tokens per request, for both Astra and Sol.

Can I use the GPT-6.2 API with Codex?

Yes. Run printenv OPENAI_API_KEY | codex login --with-api-key, then pick a GPT-6.2 model. Codex then bills your OpenAI Platform account at standard API rates instead of using ChatGPT plan credits.

How to Run GPT-6.2 Astra and Sol APIs in Coding Agents