Set OPENDUNES_API_KEY as a Replit secret and call OpenDunes models from any Replit workspace.
Replit workspaces support secrets — encrypted environment variables that are available to your code at runtime but never exposed in the editor. Store your OPENDUNES_API_KEY as a secret and you can call OpenDunes from any language Replit supports.
OPENDUNES_API_KEYThe secret is now available as an environment variable to all runs in that workspace.
Create a new Python Repl and install the OpenAI SDK:
pip install openaiThen:
import os
from openai import OpenAI
client = OpenAI(
base_url="https://opendunes.com/v1",
api_key=os.environ["OPENDUNES_API_KEY"],
)
resp = client.chat.completions.create(
model="anthropic/claude-sonnet-5",
messages=[{"role": "user", "content": "What is the capital of Algeria?"}],
)
print(resp.choices[0].message.content)Create a new Node.js Repl and install the OpenAI SDK:
npm install openaiThen:
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://opendunes.com/v1",
apiKey: process.env.OPENDUNES_API_KEY,
});
const resp = await client.chat.completions.create({
model: "google/gemini-2.5-pro",
messages: [{ role: "user", content: "What is the capital of Algeria?" }],
});
console.log(resp.choices[0].message.content);Streaming works the same way as in any other environment — set stream: true and iterate the response:
stream = client.chat.completions.create(
model="meta-llama/llama-4-maverick",
messages=[{"role": "user", "content": "Write a short poem about the Hoggar mountains."}],
stream=True,
)
for chunk in stream:
delta = chunk.choices[0].delta.content
if delta:
print(delta, end="", flush=True)GET /api/models from within your Repl.