← All guides
AI Development

Call GPT-6 Astra through DigitalOcean with the Responses API

Call GPT-6 Astra through DigitalOcean with the Responses API. Check access, create a key, send a request and compare costs before adding routing or agents.

Jump to steps

Call GPT-6 Astra through DigitalOcean

You can call GPT-6 Astra through DigitalOcean with a model access key and an HTTPS request. The detail that matters is the endpoint. DigitalOcean lists Astra as Responses API only for serverless prompts, so an existing Chat Completions integration needs more than a different model name.

This guide takes you from account checks to one text response, then shows how to decide whether routing or an agent belongs in the application. You will use Python 3 and its standard library. There is no SDK dependency, GPU deployment or separate OpenAI account to configure.

The Inference Engine update includes Astra in Serverless Inference, Evaluations, model synthesis and Inference Router. The catalog lists a 1,050,000-token context window and a 128,000-token maximum output. This tutorial starts with text alone. Check the documentation for each additional capability before wiring it into your application.

Disclosure: This article contains DigitalOcean affiliate links. If you purchase through them, I may earn a commission at no extra cost to you. This recommendation follows a review of the documentation; I have not run a paid Astra request for this article.

Sources checked on 12 September 2026. The DigitalOcean changelog announced Astra on September 8; the documentation release notes list availability on September 4. I use September 8 as the announcement date, rather than claiming it was the first day of access.

Check access before adding a balance

Start in the DigitalOcean account and team that will pay for the requests. The serverless limits page excludes commercial OpenAI models from tiers 1 and 2. Check Resource Limits and confirm Astra access before funding a new account for this tutorial. A referral signup does not guarantee that access.

You also need a positive Serverless Inference prepaid balance. Confirm the amount and payment terms shown in the Control Panel. Do not assume promotional cloud credits cover this product or that a deposit alone changes your tier. Ask support about an access restriction before making repeated deposits.

For the local examples, use macOS or Linux with Bash and Python 3 installed. Windows readers can use WSL with those tools installed inside it. Open a fresh terminal and enter bash before the key prompt, because macOS commonly starts zsh and its read options differ.

Keep the first input harmless. The sample asks about HTTP 429 and contains no repository files or customer records. A real application should first decide what information it is allowed to send to a hosted model.

Enable access to the shared inference endpoint

For this serverless path, you enable account and credential access to an existing URL. You do not provision a dedicated Astra endpoint or create an Agent Platform agent. The base URL is https://inference.do-ai.run/v1; the request below goes to /responses.

In the Control Panel, open INFERENCE, then Manage. Choose Create model access key, name it for this test and select GPT-6 Astra under the foundation model scope. For a laptop request, choose No VPC network. A VPC-restricted key requires requests from its permitted network.

Finish with Add model access key and store the secret securely when it appears. The documented flow shows it once. Use a separate test key so removing it later does not interrupt an application. Neither an agent endpoint key nor an OpenAI API key is the credential used here.

The environment variable below is a local naming choice. Run it in your Bash terminal and paste the secret only at the hidden prompt. Do not put the key in a frontend bundle, a screenshot or a committed configuration file.

Before continuing: Enter the secret only at the hidden Bash prompt.

Enter the key in BashLocal terminal
set +x
read -r -s -p 'DigitalOcean model access key: ' DO_INFERENCE_API_KEY
printf '\n'
export DO_INFERENCE_API_KEY
if [ -z "$DO_INFERENCE_API_KEY" ]; then
  printf 'Missing key. Stop here.\n'
fi

Verify the DigitalOcean GPT-6 Astra model ID

The documented ID is openai-gpt-6-astra. Display names, direct-provider IDs and router names are different identifiers. Check the exact ID before debugging your prompt or installing another library.

The following script lists models and prints whether that ID appears. It sends no generation prompt. A successful list request checks the endpoint and credential path, but does not prove your next inference request will be accepted or that every model capability is available.

If the result is false, stop and inspect the catalog, key scope and team access. Do not silently substitute another model and count that as an Astra test. Keep this terminal open because the next script reads the same environment variable.

Check the model listLocal terminal
python3 - <<'PYTHON'
import json, os, urllib.error, urllib.request
key = os.environ.get("DO_INFERENCE_API_KEY")
if not key:
    raise SystemExit("Missing DO_INFERENCE_API_KEY")
request = urllib.request.Request(
    "https://inference.do-ai.run/v1/models",
    headers={"Authorization": "Bearer " + key},
)
try:
    with urllib.request.urlopen(request, timeout=30) as response:
        models = json.load(response)["data"]
    found = any(m.get("id") == "openai-gpt-6-astra" for m in models)
    print("GPT-6 Astra listed:", found)
    if not found:
        raise SystemExit("Stop and check model availability and key scope")
except urllib.error.HTTPError as error:
    raise SystemExit(f"HTTP {error.code}: check key, scope and account access")
except (urllib.error.URLError, TimeoutError):
    raise SystemExit("Network or timeout failure; check connectivity")
PYTHON

Make your first GPT-6 Astra API call

Run the script below once. It sends a billed request to the Responses API with a short text input and an output ceiling of 1,024 tokens. That ceiling leaves room for reasoning; it does not promise a 1,024-token answer or a completed response.

The payload deliberately omits sampling controls and tools. Start with the smallest integration you can diagnose, then add optional fields only after checking support for this model. Copying every option from a generic API example makes it harder to identify an unsupported parameter.

The script prints the returned model, status, usage and assistant text. It walks the output items instead of assuming the first item is an answer. A Responses result can include other item types, and a Chat Completions parser looking for choices[0] will not read this format.

Success means a completed response containing a readable explanation of HTTP 429. The exact wording will vary. Save the model ID, token totals and request time in your own test notes. This establishes a single text call, not streaming, structured output or tool execution.

If you need a new account after checking eligibility, the referral action below opens DigitalOcean. Existing customers can continue with their current account. The link does not create a key, fund inference or configure this script.

Before continuing: Sends one billed Astra request. Check access and pricing first.

Send one billed text requestLocal terminal
python3 - <<'PYTHON'
import json, os, urllib.error, urllib.request
key = os.environ.get("DO_INFERENCE_API_KEY")
if not key:
    raise SystemExit("Missing DO_INFERENCE_API_KEY")
payload = {
    "model": "openai-gpt-6-astra",
    "input": "Explain HTTP 429 in one sentence for an API developer.",
    "max_output_tokens": 1024,
    "stream": False,
}
request = urllib.request.Request(
    "https://inference.do-ai.run/v1/responses",
    data=json.dumps(payload).encode("utf-8"),
    headers={
        "Authorization": "Bearer " + key,
        "Content-Type": "application/json",
    },
)
try:
    with urllib.request.urlopen(request, timeout=120) as response:
        result = json.load(response)
except urllib.error.HTTPError as error:
    raise SystemExit(f"HTTP {error.code}: consult the troubleshooting section")
except (urllib.error.URLError, TimeoutError):
    raise SystemExit("Network or timeout failure; inspect usage before retrying")
print("Model:", result.get("model"))
print("Status:", result.get("status", "not supplied"))
print("Usage:", json.dumps(result.get("usage", {})))
texts = [
    part["text"]
    for item in result.get("output", [])
    if item.get("type") == "message"
    for part in item.get("content", [])
    if part.get("type") == "output_text" and isinstance(part.get("text"), str)
]
if result.get("status") != "completed" or not texts:
    raise SystemExit("No completed text answer. Check status and output budget before retrying.")
print("\n".join(texts))
PYTHON

Troubleshoot the request you actually sent

An HTTP error is a clue about the failing layer. Check the request path and account state before changing the prompt. The scripts suppress raw error bodies to avoid encouraging readers to post unreviewed logs; inspect a redacted error locally when you need more detail.

A timeout is ambiguous. The server may have processed the request even when your client stopped waiting. Check usage before resending, and avoid automatic retries during the first test. A retry can generate a second billable answer.

If the status is incomplete or there is no output_text, inspect the response status and incomplete details. A small output budget may leave no room for the final answer. Increase it deliberately after checking the price, rather than retrying indefinitely.

Scroll horizontally to see all columns.

First checks for failed calls
ResultCheck next
401 or 403Key validity, model scope, permitted network and commercial model access.
400 or 404Exact model ID, /v1/responses path and supported request fields.
429Account quotas and any Retry-After guidance; reduce concurrency.
Completed JSON, no displayed answerUse Responses output items, not a Chat Completions choices parser.

Choose direct calls, routing or an agent

Keep the direct Astra call when you want to measure Astra itself or your application already knows which model to use. For example, a developer tool might reserve it for explaining a difficult test failure after cheaper checks have failed. You control which requests incur its rates.

Inference Router selects among model pools using task descriptions and selection policies. DigitalOcean documents a router: prefix in the model field and supports calling routers through Responses. Configure a real router first, check its permitted models and retain the returned model in your logs. A routed request is not necessarily an Astra request.

An agent adds a workflow around inference. Your application may execute functions and send results back, or use supported server-side tools. A plain text request does not give Astra a browser, filesystem or terminal. The advertised computer-use capability is not proof that your application has implemented those tools.

For a coding assistant, begin with a disposable input and inspect each proposed tool action. Require explicit approval for writes until the permissions are tested. The linked OpenCode diagnostic uses Chat Completions, so it is useful for the testing method but is not an Astra configuration to copy unchanged.

Scroll horizontally to see all columns.

Choose the integration by its job
PathUseful whenTradeoff
Direct AstraYou need a fixed model for a task or baseline.Every request uses Astra pricing.
Inference RouterDifferent tasks justify different model costs.Selection and fallback behavior need evaluation.
Agent workflowThe application must use tools across several turns.Permissions, tool failures and total task cost become your responsibility.

Estimate GPT-6 Astra pricing before a workload

DigitalOcean lists the following USD rates on 12 September 2026. The threshold applies to prompt length. The large context window is a capacity limit, not a recommendation to send an entire repository on each turn.

For an illustrative uncached request with 2,000 input tokens and 500 billed output tokens, the standard rates give $0.02 plus $0.025, or $0.045. One thousand identical requests would cost $45 in model tokens. This is arithmetic, not a measured workload or an invoice estimate.

Use the API usage totals rather than the visible answer length. Reasoning can consume output tokens. Tool fees, retries, evaluation runs and any separate application hosting are outside the example. Several agent turns can cost much more than one question with the same final answer.

For budgeting, multiply representative token usage by expected request volume, then model a retry scenario separately. Measure cost per accepted result. A more expensive call can be reasonable if it fixes a problem the cheaper model repeatedly misses; a polished answer alone does not establish that value.

Scroll horizontally to see all columns.

Astra model rates, USD per million tokens, checked September 12, 2026
Prompt lengthInputOutput
Up to 272K tokens$10$50
Over 272K tokens$20$75

Decide whether this setup earns its cost

The strongest reason to choose this path is operational convenience for an existing DigitalOcean team. You can use its inference credentials and billing while keeping your first application small. You also avoid maintaining a GPU deployment for occasional requests.

The disadvantages are concrete. New accounts may not qualify for this commercial model. Astra needs a Responses-compatible client. The prepaid balance and quotas can stop traffic, and high output rates make unrestricted background loops a poor first deployment.

If you already have a working direct-provider integration, moving it needs a reason beyond a launch announcement. Compare the API features you actually call, support arrangements and billing workflow. This guide does not establish feature parity with OpenAI or claim that DigitalOcean makes the model cheaper.

Before rollout, create a small dataset of representative tasks with explicit acceptance criteria. Record correctness, latency and billed usage for Astra and a cheaper candidate. Include a case the application should decline and a case that exceeds your intended input budget. Review outputs manually; an automated judge is supporting evidence.

My recommendation is to start with one direct request, then a bounded evaluation. Add routing when your results show different task types need different models. Add an agent when tools are necessary to finish the job. Each addition should solve a problem you have already observed.

Finish the test and connect your backend

When finished, run unset DO_INFERENCE_API_KEY in the same terminal. Remove the disposable key in the Control Panel if it is no longer needed. Unsetting a variable clears that shell value; it does not revoke the credential.

For an application, store the key in backend secret configuration and put your own authentication in front of the inference route. Define a timeout, concurrency limit and output budget. Return a useful error when access or balance is unavailable. Keep prompts and secrets out of routine logs.

The next useful checkpoint is a real completed response under your account, followed by a measured evaluation. The local examples and documentation review here do not establish your account access or production reliability.

Clear the local environment variableLocal terminal
unset DO_INFERENCE_API_KEY

Common questions

Do I need a separate OpenAI account? Not for this DigitalOcean-billed path. You need an eligible DigitalOcean account, positive prepaid inference balance and model access key. Bringing your own provider key is a different billing path.

Can I use Chat Completions with Astra? DigitalOcean lists Responses API only for Astra serverless prompts. Use /v1/responses with openai-gpt-6-astra. Changing only the model name in a Chat Completions client is insufficient.

Do I need to create an agent or GPU? No. This serverless path uses the shared inference endpoint. Tools and agent loops require additional integration.

Will a new account have Astra access? Not necessarily. The serverless limits exclude commercial OpenAI models from tiers 1 and 2. Confirm access before paying for this test.

Was the article's request run against Astra? No paid Astra request was run for this article. The recipe follows the cited documentation; you must confirm a completed response and usage under your own account.

Check your result

Expected result
Completed status, assistant text and usage for Astra.
Stop if
Stop on missing access, HTTP error or incomplete output.
Next step
Measure representative tasks before routing or agent tools.