Step 1: Before you start
- An API key: sign up, top up your balance, then create a key in the dashboard. Put your key where
<API_KEY>appears below. - The name of the model you want to use, from Models. The examples below use
claude-haiku-5-5.
Step 2: Set up OpenAI SDK
For developers: use the OpenAI library and change only the base URL and key.
Python
Python
from openai import OpenAI
client = OpenAI(base_url="https://api.goiapi.com/v1", api_key="<API_KEY>")
reply = client.chat.completions.create(
model="claude-haiku-5-5",
messages=[{"role": "user", "content": "Hello"}],
)
print(reply.choices[0].message.content)Node.js
JavaScript
import OpenAI from 'openai';
const client = new OpenAI({ baseURL: 'https://api.goiapi.com/v1', apiKey: '<API_KEY>' });
const reply = await client.chat.completions.create({
model: 'claude-haiku-5-5',
messages: [{ role: 'user', content: 'Hello' }],
});
console.log(reply.choices[0].message.content);Step 3: Send a test message
Send a short message (for example "Hello") from OpenAI SDK. The Request history page in the dashboard shows the request as soon as it happens, with token counts and cost.
If something fails, see Error codes: 401 means the key is wrong or missing, 402 means your balance is too low, 404 means the model name is wrong.