curl, Python 3.9+ with pip, and the openai Python SDK 1.x or newer.env with the key, a verified curl call, a Python client, and a CLI client all pointing at the same OpenAI-compatible endpointAnything marked (check the documentation) — base URL, exact model ID, and prices — is provider-specific and must be copied from your dashboard, not guessed.

curl available: curl --version → prints something like curl 8.4.0python3 --versionopenai package: python3 -m pip install --upgrade "openai>=1.0".env, e.g. ~/projects/astra-smokeExample: create the workspace and confirm the toolchain in one go:
mkdir -p ~/projects/astra-smoke && cd ~/projects/astra-smoke
python3 -m pip install --upgrade "openai>=1.0"
python3 -c "import openai; print(openai.__version__)"
Expected output is a version number such as 1.55.0. If pip fails with error: externally-managed-environment, create a virtual environment first:
python3 -m venv .venv && source .venv/bin/activate
How the request actually flows — this is the mental model you need before configuring anything:
1. Your client reads two environment variables: GPT6_API_KEY (the secret) and GPT6_BASE_URL (the API host, for example https://<your-api-host>/v1).
2. It sends POST <base-url>/chat/completions over HTTPS with the header Authorization: Bearer $GPT6_API_KEY.
3. The gateway validates the key, checks your plan's quota and rate limit, then routes the request to the Astra model.
4. The response arrives as JSON: the text is in choices[0].message.content, and token counters are in usage.prompt_tokens / usage.completion_tokens.
5. Billing is metered from those usage counters, which is why you verify them in Step 3 rather than trusting the dashboard alone.
Checklist before you start:
.env added to .gitignoreecho $HTTPS_PROXYWhat to do: Sign in to the provider console, open the API keys section (usually Dashboard → API Keys → Create new secret key), name the key something traceable like astra-smoke-macbook, and copy the value immediately. Then create the local config files.
Why: The key is shown once; if you lose it you must rotate it. Naming keys per machine lets you revoke one laptop without breaking CI.
Example: create .env in ~/projects/astra-smoke:
GPT6_API_KEY=<your-api-key>
GPT6_BASE_URL=<your-api-base-url>
GPT6_MODEL=<model-id-from-the-models-endpoint>
Load it into the current shell and prove .env is not tracked by git:
set -a; source .env; set +a
git init -q 2>/dev/null; printf ".env\n.venv/\n" >> .gitignore
git check-ignore -v .env
Expected output: .gitignore:1:.env .env — the rule that matches the file. If the command prints nothing and exits with code 1, the file is not ignored; fix .gitignore before the first commit.
Windows PowerShell equivalent:
$env:GPT6_API_KEY = "<your-api-key>"
$env:GPT6_BASE_URL = "<your-api-base-url>"
How to check: confirm the variable is set without printing the secret:
test -n "$GPT6_API_KEY" && echo "key loaded: ${#GPT6_API_KEY} chars"
curl -s -o /dev/null -w "%{http_code}\n" "$GPT6_BASE_URL/models" -H "Authorization: Bearer $GPT6_API_KEY"
You want key loaded: 48 chars (your length will differ) and 200. A 401 means the key string is wrong or has stray whitespace; 404 usually means GPT6_BASE_URL is missing the version segment.
Record the details you will need later — fill the right column from your console, not from this guide:
| Field | Where to get it | Your value |
|---|---|---|
| Base URL | API reference page in the console **(check the documentation)** | `<your-api-base-url>` |
| API key | **Dashboard → API Keys** | stored in `.env` only |
| Model ID | output of `GET /models` (Step 2) | `<model-id-from-the-models-endpoint>` |
| Price per input/output token | pricing page **(check the documentation)** | — |
| Rate limit (requests/min, tokens/min) | plan page **(check the documentation)** | — |
Plan structure and payment methods are described in GPT-6.1 Sol Pricing and Access: Plans and Payment Methods — read it for how the vendor packages plans, then confirm the Astra numbers on your own pricing page.

What to do: Ask the API which model IDs your key can actually use, then wire that exact string into three clients: curl, the Python SDK, and a CLI tool that speaks the OpenAI-compatible protocol.
Why: Model IDs are strings, not marketing names. Copying gpt-6-astra from a blog post instead of from GET /models is the single most common cause of model_not_found.
Example — list models and pick the ID:
curl -s "$GPT6_BASE_URL/models" -H "Authorization: Bearer $GPT6_API_KEY" \
| python3 -c "import json,sys; [print(m['id']) for m in json.load(sys.stdin)['data']]"
Output is one ID per line. Copy the Astra one into GPT6_MODEL in .env, reload with set -a; source .env; set +a.
Example — raw HTTP call:
curl -s "$GPT6_BASE_URL/chat/completions" \
-H "Authorization: Bearer $GPT6_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"'"$GPT6_MODEL"'","messages":[{"role":"user","content":"Reply with the single word: ok"}],"max_tokens":16}'
Example — Python client (client.py):
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["GPT6_API_KEY"], base_url=os.environ["GPT6_BASE_URL"])
resp = client.chat.completions.create(
model=os.environ["GPT6_MODEL"],
messages=[{"role": "user", "content": "Reply with the single word: ok"}],
max_tokens=16,
)
print(resp.choices[0].message.content)
Run it with python3 client.py. The base_url parameter is what makes a non-OpenAI endpoint work: the SDK only swaps the host and keeps the request schema identical.
Example — CLI client config. Most terminal agents accept an OpenAI-compatible provider block. A minimal config.json looks like this:
{
"provider": "openai-compatible",
"base_url": "<your-api-base-url>",
"model": "<model-id-from-the-models-endpoint>",
"api_key_env": "GPT6_API_KEY"
}
The api_key_env field keeps the secret out of the file — the tool reads the environment variable at start-up. If your tool needs the key inline instead, export it in the shell profile (~/.zshrc) rather than hard-coding it. For a full walkthrough of pointing a coding agent at a custom OpenAI-compatible endpoint, see How to connect a local LLM to Claude Code: llama-server and an OpenAI-compatible API — the endpoint configuration is the same pattern, only the host differs.
How to check: the Python script must print ok. In the raw curl response, confirm three keys exist:
curl -s "$GPT6_BASE_URL/chat/completions" -H "Authorization: Bearer $GPT6_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"'"$GPT6_MODEL"'","messages":[{"role":"user","content":"ping"}],"max_tokens":8}' \
| python3 -c "import json,sys; d=json.load(sys.stdin); print(d['model'], d['usage'])"
Expected: your model ID followed by a dict such as {'prompt_tokens': 8, 'completion_tokens': 1, 'total_tokens': 9}. Numbers will vary — what matters is that usage is present, because that is the field billing reads.
If you have not decided between Astra and the sibling Sol model yet, compare them first in GPT-6 Astra vs GPT-6.1 Sol: which to choose for work, chat and API before you hard-code IDs in production configs.

What to do: Run a smoke test that measures latency, prints the resolved model, and writes a reusable shell wrapper. Then freeze the working values so the next session starts from a known-good state.
Why: A single manual call proves the key works once; a script proves it works after a shell restart, which is when environment variables usually disappear.
Example — smoke.py:
import os, time
from openai import OpenAI
client = OpenAI(api_key=os.environ["GPT6_API_KEY"], base_url=os.environ["GPT6_BASE_URL"])
t0 = time.time()
r = client.chat.completions.create(
model=os.environ["GPT6_MODEL"],
messages=[{"role": "user", "content": "ping"}],
max_tokens=8,
)
print("model:", r.model)
print("latency_ms:", int((time.time() - t0) * 1000))
print("tokens_in:", r.usage.prompt_tokens, "tokens_out:", r.usage.completion_tokens)
Run python3 smoke.py. Success looks like three lines:
model: <model-id-from-the-models-endpoint>
latency_ms: 740
tokens_in: 8 tokens_out: 1
Your latency figure is the baseline — re-run the script after any network or proxy change and compare, because a jump from ~700 ms to multi-second values almost always means traffic is going through a different route.
Example — persist the environment so you do not repeat Step 1 every session:
grep -q GPT6_API_KEY ~/.zshrc || cat >> ~/.zshrc <<'EOF'
export GPT6_API_KEY="$(grep '^GPT6_API_KEY=' ~/projects/astra-smoke/.env | cut -d= -f2-)"
export GPT6_BASE_URL="<your-api-base-url>"
export GPT6_MODEL="<model-id-from-the-models-endpoint>"
EOF
Open a new terminal, run python3 smoke.py again, and confirm identical output. How to check: the script exits with code 0 and prints all three lines; echo $? right after returns 0.
Problem. Every request fails with 401 right after you copied a new key
{"error":{"message":"Incorrect API key provided: sk-***. You can find your API key at ...","type":"invalid_request_error","code":"invalid_api_key"}}.env line picked up a trailing space or invisible quote character.grep '^GPT6_API_KEY=' .env | cat -A — a trailing $ should be the last character before the line ends, with no spaces before it. Then run set -a; source .env; set +a and repeat the /models call.Problem. The key is valid but the chat call fails with a model error
{"error":{"message":"The model 'gpt-6-astra' does not exist or you do not have access to it.","type":"invalid_request_error","code":"model_not_found"}}GET /models, or the model is not enabled on your current plan.curl -s "$GPT6_BASE_URL/models" -H "Authorization: Bearer $GPT6_API_KEY" | python3 -m json.tool | grep '"id"'. If Astra is absent from the list, access is not provisioned on your account — check the plan page (check the documentation) before changing code.Problem. Calls start returning 429 after a few minutes of testing
{"error":{"message":"Rate limit reached for requests","type":"requests","code":"rate_limit_exceeded"}}You now have a key stored outside version control, a verified model ID pulled from GET /models, and three clients — curl, the Python SDK, and a CLI tool — hitting the same OpenAI-compatible endpoint with a repeatable smoke test. Next, move GPT6_MODEL into your app's config layer, add retry-with-backoff around the client, and track usage counters daily so a pricing change never surprises you.
Where do I find the GPT-6 Astra API key?
In the provider console under Dashboard → API Keys → Create new secret key. The value is displayed once at creation, so copy it straight into .env; if you lose it, delete the key and create a new one.
How much does the GPT-6 Astra API cost?
Pricing is per token (input and output counted separately) and is set by the provider, so the exact figures must be read from the pricing page in your console — do not rely on third-party numbers. For how this vendor structures plans and payment methods, see the pricing guide linked in Step 1.
Does GPT-6 Astra work with the OpenAI Python SDK and other OpenAI-compatible tools?
Yes — you only change two things: pass base_url to the OpenAI() client and use the exact model ID returned by GET /models. The request and response schema stays the same, which is why the same config block works in CLI agents too.
Which model string do I put in the model field?
The id value from GET /models, character for character. Marketing names and version numbers from articles are not guaranteed to be valid IDs, and a wrong string returns model_not_found rather than a helpful suggestion.