Node.js
The platform is OpenAI-compatible, so use the official openai npm package and change baseURL.
OpenAI SDK
bash
npm install openaijs
import OpenAI from "openai";
const client = new OpenAI({
apiKey: "sk-your-key",
baseURL: "https://gateway.mindproxy.ai/v1",
});
const resp = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Hello" }],
});
console.log(resp.choices[0].message.content);Streaming
js
const stream = await client.chat.completions.create({
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Write a short poem" }],
stream: true,
});
for await (const chunk of stream) {
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
}Image generation
js
const img = await client.images.generate({
model: "gpt-image-1",
prompt: "a city at night",
n: 1,
size: "1024x1024",
});
console.log(img.data[0].url);Claude (Anthropic SDK)
bash
npm install @anthropic-ai/sdkjs
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
apiKey: "sk-your-key",
baseURL: "https://gateway.mindproxy.ai", // SDK appends /v1/messages
});
const msg = await client.messages.create({
model: "claude-3-5-sonnet",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello" }],
});
console.log(msg.content[0].text);Passing extra headers
js
const resp = await client.chat.completions.create(
{
model: "gpt-4o-mini",
messages: [{ role: "user", content: "Hello" }],
},
{
headers: {
"Idempotency-Key": "my-unique-key-001",
// "X-TT-Dry-Run": "true",
},
},
);Troubleshooting
- 404: one too many / too few
/v1at the end ofbaseURL. - 401: wrong or disabled key.
- Error shapes and status codes: Errors & rate limits.