GetAPI.ONE
Call GetAPI.ONE from Python
Install the official OpenAI Python SDK, point it at the ONE base URL, make a controlled Responses request, and verify the result without putting credentials in source code.
Prepare the project and credential
- Python 3.10 or newer and a virtual environment.
- An enabled GetAPI.ONE API key with a deliberate expiry and quota.
- A model ID copied from the current catalog whose declared endpoint is Responses.
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade openaiConfigure and send the request
- Set GETAPI_ONE_API_KEY in the process environment; do not paste the key into the file.
- Create the client with https://www.getapi.one/v1 as base_url.
- Replace the conspicuous model placeholder with an exact current catalog ID that declares Responses.
- Run the script only when you accept that the request may be billed.
- The first verification disables SDK retries. Add only bounded, observable retries after deciding which operations are safe to repeat.
import os
from openai import OpenAI
api_key = os.environ.get("GETAPI_ONE_API_KEY")
if not api_key:
raise RuntimeError("Set GETAPI_ONE_API_KEY before running this program")
with OpenAI(
api_key=api_key,
base_url="https://www.getapi.one/v1",
timeout=30.0,
max_retries=0,
) as client:
response = client.responses.create(
model="<MODEL_ID_FROM_CURRENT_CATALOG>",
input="Reply with one short readiness check.",
)
print(response.output_text)Understand the contract
| Field | Required value |
|---|---|
| base_url | https://www.getapi.one/v1 |
| api_key | GETAPI_ONE_API_KEY from the server environment |
| model | Exact ID from the current catalog |
| method | client.responses.create |
Verify the expected result
- The process exits without an authentication or endpoint error.
- response.output_text contains the requested short answer.
- The GetAPI.ONE console shows a matching request or usage record for the key.
Fix common errors
| Symptom | Check |
|---|---|
| 401 or authentication error | Re-copy the ONE key, confirm it is enabled, and verify the environment variable belongs to this process. |
| 404 | Keep exactly one /v1 in base_url and use the Responses method only for a model that declares that endpoint. |
| Model unavailable or incompatible | Copy the exact ID again from the current catalog; do not infer aliases. |
Keep the integration safe
- Run the SDK only in trusted server or local tooling code, never in browser JavaScript.
- Exclude .env files from version control and rotate a key immediately if it is exposed.
- Use separate bounded keys for development and production.
Next steps
- Stream a responseHandle SSE lifecycle events and terminal outcomes.
- Choose a modelMatch the task to the catalog endpoint contract.