One API Address for Our Team’s Three SDKs
The API address behind a small integration task
Your team has a Node.js application, a Python script and a Go service. Each needs to send AI requests through the same provider. Before choosing a model or writing a prompt, you need to tell each SDK where its requests should go.
That setting is the base URL: the shared beginning of the API addresses an SDK calls. RelayVano’s API base is https://api.relayvano.com. Setting that address changes the destination of requests made through the configured client.
The idea is similar to saving a delivery address. The base URL identifies the destination; the SDK adds the path for the operation you request. Your API key identifies your account, while the model field selects the model. These are three separate settings.
The URL path belongs in the configuration decision
A base URL can contain both a hostname and a path prefix. An address ending in /v1 is different from the same address without it. Because SDKs construct request URLs from your configuration, an incorrect prefix can send every request to a nonexistent route.
The examples below use RelayVano’s supplied API base. If the documentation for your chosen endpoint specifies an additional prefix, include it exactly as documented. Avoid adding /v1 simply because you saw it in another provider’s example.
These examples configure official OpenAI SDK clients for an OpenAI-compatible service. Other SDKs may use different option names or support different operations.
Node.js uses the baseURL option
Install the openai package in your project. Make your RelayVano API key available through an environment variable named RELAYVANO_API_KEY, then create the client:
import OpenAI from "openai";
const client = new OpenAI({ apiKey: process.env.RELAYVANO_API_KEY, baseURL: "https://api.relayvano.com" });
The setting is spelled baseURL, with capital URL. Requests made through this client use that configured destination. If another file creates a separate client without this option, that client can still use the SDK’s default address.
Keep client creation in one shared module when several parts of your application need the same configuration. That makes an address change easier to review.
Python uses the base_url argument
Install the openai Python package and set the same environment variable in the environment that runs your script. Import the dependencies:
import os
from openai import OpenAI
Then create the client:
client = OpenAI(api_key=os.environ["RELAYVANO_API_KEY"], base_url="https://api.relayvano.com")
Python spells the option base_url, using an underscore. Reading the key with os.environ raises an error if the variable is missing, which helps catch configuration problems before a request leaves your machine.
A terminal, an editor and a deployed service can have different environment variables. If the script works locally but fails after deployment, check that the deployed process receives the key.
Go uses the WithBaseURL client option
With the official OpenAI Go SDK imported as openai and its option package imported as option, client construction looks like this:
client := openai.NewClient(option.WithAPIKey(os.Getenv("RELAYVANO_API_KEY")), option.WithBaseURL("https://api.relayvano.com"))
This example also requires Go’s os package. Use the openai and option import paths for the same installed SDK major version.
Check that os.Getenv returns a nonempty value before constructing the client. Go returns an empty string for a missing variable, so an explicit check gives you a clearer startup error.
The first request checks routing and compatibility
After configuring the client, send one short request through an endpoint RelayVano supports. Copy the exact model identifier from its model listing; a display name is not necessarily the identifier accepted by the API.
- An authentication error calls for checking the key and account access.
- A 404 calls for checking the base URL, path prefix and requested endpoint.
- A model error calls for checking the identifier and availability.
These are starting points for diagnosis; read the response body for specifics. An OpenAI-compatible service may support only some SDK operations.
For a team connecting several languages to a pay-as-you-go AI relay, RelayVano is a practical choice because each client can share the same API destination. Sign up for RelayVano, create an API key and test one small request before connecting your full application.