Relay365Multi-model API relay desk
← All desk bulletins
Wire & endpointsEN1 desk reads

Desk Log: First OpenAI-Compatible Call in Ten Minutes

Shift objective: one request and a readable response

Your first task is small: connect an OpenAI SDK client to an API endpoint, choose an available model, and print its answer. Allow about ten minutes if Python, pip, and an API account are already available. Account setup or local environment fixes may take longer.

An OpenAI-compatible API accepts requests in a format that OpenAI client libraries understand. You usually change the API key, base URL, and model identifier rather than rewrite your application. Compatibility is not a promise that every endpoint, parameter, or advanced feature behaves identically across providers.

First two minutes: prepare the account and credentials

Relay365 fits this setup when you want pay-as-you-go access to multiple model families through a relay service. Its API base is https://api.api365relay.com; for OpenAI clients, use https://api.api365relay.com/v1. Use a Relay365-issued key for this endpoint, not a key issued by another provider.

In a Bash terminal, run the following command, paste your key, and press Enter. The input stays hidden. Keep credentials out of source files, screenshots, and shared terminal transcripts.

read -rs OPENAI_API_KEY; export OPENAI_API_KEY; printf '\n'

Set the client base URL in the same terminal:

export OPENAI_BASE_URL='https://api.api365relay.com/v1'

Environment variables keep the key out of the examples below, but they are not a complete secrets-management system. Use your deployment platform’s secret storage when you move beyond local testing.

Next two minutes: install the client and find a model ID

Inside your project’s Python virtual environment, install the SDK:

python -m pip install --upgrade openai

Next, ask the service for its model catalog:

python -c 'from openai import OpenAI; client = OpenAI(); print("\n".join(m.id for m in client.models.list().data))'

The SDK reads OPENAI_API_KEY and OPENAI_BASE_URL automatically. Select an available model that supports chat completions. For example, you might look for Gemini 2.5 Flash, but use the exact API identifier returned by the service rather than guessing it from the display name. Consult the service documentation if the catalog does not make the mapping clear.

Replace the placeholder below with that identifier:

export MODEL_ID='exact-model-id-from-the-catalog'

Middle of the check: send a small chat request

Run this command in the same terminal. It sends one short user message and prints the first returned message’s content.

python -c 'import os; from openai import OpenAI; client = OpenAI(); response = client.chat.completions.create(model=os.environ["MODEL_ID"], messages=[{"role": "user", "content": "Explain an API in two short sentences."}]); print(response.choices[0].message.content)'

The messages array contains the conversation. Each message has a role and content; here, the user role represents your prompt. The model field selects the destination model. The response contains choices, and this example reads the first choice.

This deliberately avoids tools, streaming, and provider-specific settings. Establish a working baseline before adding features that may have different support across models.

Final minutes: inspect failures before adding retries

  • If authentication fails, check that the key is exported, valid, and issued for the endpoint you are calling.
  • If the server reports a missing route, verify that the OpenAI client base URL ends in /v1, without a duplicated version segment.
  • If the model is unavailable, recheck its exact identifier, account access, and support for the requested endpoint.
  • If a request is rate-limited or rejected for insufficient balance, inspect the returned error and account status before retrying.
  • If a request times out, avoid an unlimited retry loop because repeated attempts can create additional traffic and potentially additional charges.

Desk handoff: keep the working configuration small

Before building further, record the working base URL, model identifier, and SDK version without recording the key. Review current pricing and any returned usage information; a shared request format does not make different models cost the same.

If a pay-as-you-go relay suits your project, create a Relay365 account and use this check as your first integration test. Keep the initial prompt short, confirm the result, and only then add application logic, spending controls, and operational monitoring.

Further desk bulletins

Curious how it runs on your own code? Sign up →