Quickstart
In this tutorial, you send your first chat call through proxium. You add OpenAI to your project with your own OpenAI key. Then you make a virtual key, find a model id, and send the call. At the end, you see the call in the console.
You need:
- A proxium account. Sign in at proxium.tech/app.
- An OpenAI API key. Get one at platform.openai.com/api-keys.
curlandjq. For the Python or Node example, also Python 3 or Node.js 18 or later.
1. Open your project
proxium makes a project for you when you first sign in. The console shows its name at the top of the screen.
If the console shows One thing first, proxium could not make the project. Make it yourself:
- Type a name in Project name.
- Select Create project.
2. Add OpenAI to the project
A new project has no provider. Until you add one, the console shows the banner No AI endpoints available — this project cannot send any requests yet. A call from this project then gets 400 no models available for route.
- In the console, open Providers.
- Select Add a vendor.
- In What are you adding, select OpenAI. proxium fills in the base URL and the models.
- Paste your OpenAI key into API key.
- Select Add OpenAI.
The vendor shows in the Vendors table, with set in the Key column. proxium stores the key encrypted. The console does not show the key again.
3. Make a virtual key
Your application sends the virtual key to proxium. The virtual key is not your OpenAI key.
- Open Keys.
- Type a name for the key in Name this key, for example
quickstart. - In Tier, keep the default tier,
trial. - Select Create key. The dialog Your new key opens.
Copy the key before you close the dialog. proxium keeps only a hash of the key, and it shows the key one time only.
- Select Copy.
- Select I have copied it.
If you lose the key, select Revoke in its row of the Keys table. Then make a new key.
Put the key in an environment variable in your shell:
export PROXIUM_KEY="paste-your-virtual-key-here"
4. Find a model id
GET /v1/models lists the provider/model ids that your project can use. The OpenAI vendor of your project has the provider id t.<project>.openai, where <project> is the slug of your project.
Send the request, and put the id of gpt-4o-mini in an environment variable:
curl -s https://proxium.tech/v1/models \
-H "Authorization: Bearer $PROXIUM_KEY" | jq -r '.data[].id'
export PROXIUM_MODEL=$(curl -s https://proxium.tech/v1/models \
-H "Authorization: Bearer $PROXIUM_KEY" \
| jq -r '[.data[].id | select(endswith(".openai/gpt-4o-mini"))][0]')
echo "$PROXIUM_MODEL"
The last command prints an id such as t.<project>.openai/gpt-4o-mini. If it prints null, do step 2 again.
5. Send a chat call
Send the call with one of the clients below. The base URL is https://proxium.tech/v1, and the API key is your virtual key.
- curl
- Python
- Node
curl https://proxium.tech/v1/chat/completions \
-H "Authorization: Bearer $PROXIUM_KEY" \
-H "Content-Type: application/json" \
-d "{\"model\": \"$PROXIUM_MODEL\", \"messages\": [{\"role\": \"user\", \"content\": \"Say hello in five words.\"}]}"
Install the SDK with pip install openai. Then run this script:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://proxium.tech/v1",
api_key=os.environ["PROXIUM_KEY"],
)
response = client.chat.completions.create(
model=os.environ["PROXIUM_MODEL"],
messages=[{"role": "user", "content": "Say hello in five words."}],
)
print(response.choices[0].message.content)
Install the SDK with npm install openai. Then save this script as hello.mjs and run node hello.mjs:
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://proxium.tech/v1",
apiKey: process.env.PROXIUM_KEY,
});
const response = await client.chat.completions.create({
model: process.env.PROXIUM_MODEL,
messages: [{ role: "user", content: "Say hello in five words." }],
});
console.log(response.choices[0].message.content);
proxium sends the call to OpenAI with your OpenAI key, and returns the answer of OpenAI without change.
6. See the call in the console
- Open Requests.
- Find your call in the Attempt log. The newest attempt is first.
The Model column shows the provider/model that answered. The Outcome column shows success. The Try column shows 1, because the first attempt answered.
Next steps
- Use the OpenAI SDK: streaming, embeddings and tier names.
- Use the Anthropic SDK: the Messages API through proxium.
- Routing: send a tier name in place of a model id.
- Budgets and limits: set ceilings for a key or an application.
- Errors: what each error code means.