← Pricing & setup guides

Use an OpenAI-compatible API in Python: base URL, key and first response

Keep the OpenAI Python client and connect Standard Compute with its base URL, your API key and the standardcompute model ID. The example uses Chat Completions.

The buying decision

Use the SDK’s explicit chat.completions.create method for this endpoint. Match the API format before adopting examples that default to Responses or another provider’s built-in tools.

Watch the setup in 38 seconds

38-second setup walkthrough. The published Python example returned Connected in a production request on September 5, 2026, using OpenAI Python 2.54.0. This verifies a text connection, not task quality.

Install the client and keep your key local

Install the OpenAI Python package with python -m pip install openai. Set STANDARD_COMPUTE_API_KEY in your local environment or secret manager. Download the example and run python standardcompute-chat.py. A missing environment variable stops the script before a request is sent.

Send your first Chat Completions request

The client has an explicit provider URL, a 60-second timeout and automatic retries disabled for this first diagnostic request. It asks for one short response. Check the response and your dashboard allowance before increasing the task size.

standardcompute-chat.py
import os
from openai import OpenAI

# Run on your own computer or server. Keep the key out of source control.
client = OpenAI(
    api_key=os.environ["STANDARD_COMPUTE_API_KEY"],
    base_url="https://api.stdcmpt.com/v1",
    timeout=60.0,
    max_retries=0,
)

response = client.chat.completions.create(
    model="standardcompute",
    messages=[{"role": "user", "content": "Reply with one word: Connected"}],
    max_tokens=128,
)
print(response.choices[0].message.content)

Why base_url ends in /v1

The SDK adds /chat/completions to the base URL when chat.completions.create is called. Use https://api.stdcmpt.com/v1 as the base, rather than the complete request path. A custom hostname changes the provider receiving your request; use that provider’s key and model ID.

Chat Completions, Messages and Responses are different APIs

This script uses the OpenAI-compatible Chat Completions format. Claude Code uses an Anthropic-compatible Messages setup with a different base-URL convention. Do not assume that changing only the hostname makes Responses, embeddings or every SDK method work. Match each method to the provider’s documented endpoint.

Turn the connection into an application

After the connection succeeds, use a representative task and verify its output. For a server application, keep the key on the server and apply your own request limits. Add bounded retries only for errors where retrying makes sense; an exhausted monthly allowance needs account action. Log request identifiers and failure types without writing API keys into logs.

Run your own comparison

Use the same task, starting revision and acceptance check. Record every retry and failed attempt so the result reflects the work you actually paid for.

Sources and setup references