Choose a service and prepare accesses
This example uses the SDK Python from OpenAI and its Responses route. It is not a universal call for all platforms. Before executing, check the API account, billing and a template that you have access to. A subscription to the general public should not be assumed to be sufficient.
Install Python and follow the SDK instructions in a work environment. Prepare two variables: OPENAI_API_KEY for private access and OPENAI_MODEL for the current identifier of the chosen model. Do not publish the key in a page or capture. The example of this page does nothing and does not send any data for you.
Read an example before launching it
Install the openai package according to official documentation. The program below recovers the configuration, sends a short request and displays the resulting text. The model remains a value of your environment to avoid assuming a universal version or access. A real call can result in a billed consumption.
Choose the example for your shell. The displayed values are placeholders: use your private key and an accessible model ID, and do not share the configured values.
export OPENAI_API_KEY='YOUR_PRIVATE_API_KEY'
export OPENAI_MODEL='MODEL_ID_FROM_DOCUMENTATION'$env:OPENAI_API_KEY = 'YOUR_PRIVATE_API_KEY'
$env:OPENAI_MODEL = 'MODEL_ID_FROM_DOCUMENTATION'import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
result = client.responses.create(
model=os.environ["OPENAI_MODEL"],
input="Explain an API in one short sentence."
)
print(result.output_text)Correct an error without exposing access
If a variable is missing, configure it in the right environment. If the service refuses access or model, consult the message and documentation. Do not display the key to diagnose the problem. For a quota error, check the limits and billing before restarting.
After a successful trial, add time limits, error processing and an expense limit adapted to the service. For a public site, the call must remain on a controlled server; do not copy the secret in JavaScript sent to visitors. Also test a failure before considering integration as complete.
Questions before you start
Does this page make a paid call?
No. It displays an example; only your own program launch can call the service.
Why is the model a variable?
You must select a current identifier to which your account has access, depending on the documentation.
Does the same code work without modification with all suppliers?
No. SDKs, settings and authentication methods may differ.