OpenAI SDK with DEVUP AI
Connect standard OpenAI client libraries directly to DEVUP AI. Our platform provides full wire-format compatibility with OpenAI's REST endpoints, allowing developers to route chat completions, vector embeddings, streaming tokens, and model listings to open-source foundation models simply by updating the base URL and API key.
System Architecture
How OpenAI Clients Connect to DEVUP AI
DEVUP AI exposes a wire-compatible API gateway at https://api.devupai.com/v1. When an OpenAI SDK client makes an HTTP request, our gateway authenticates your DEVUP AI token via standard Bearer authorization, verifies local DZD balance, and dispatches inference directly to your requested foundation model.
Client Configuration
Quickstart in JavaScript, TypeScript & Python
TypeScript & JavaScript (Official openai npm package)
Install the official package and configure baseURL:
npm install openaiimport OpenAI from "openai";
const openai = new OpenAI({
apiKey: process.env.DEVUP_API_KEY,
baseURL: "https://api.devupai.com/v1",
});
async function main() {
const completion = await openai.chat.completions.create({
model: "deepseek-ai/DeepSeek-V4-Pro",
messages: [{ role: "user", content: "Hello from DEVUP AI!" }],
});
console.log(completion.choices[0].message.content);
}
main();Python (Official openai PyPI package)
Install via pip and point the base_url parameter to DEVUP AI:
pip install openaiimport os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("DEVUP_API_KEY"),
base_url="https://api.devupai.com/v1",
)
response = client.chat.completions.create(
model="deepseek-ai/DeepSeek-V4-Pro",
messages=[{"role": "user", "content": "Hello from DEVUP AI!"}],
)
print(response.choices[0].message.content)Endpoint Coverage
Verified OpenAI-Compatible Endpoints
The following endpoints are actively implemented and tested in the DEVUP AI gateway:
| Endpoint | Method | Capability | Status |
|---|---|---|---|
| /v1/chat/completions | POST | Chat completions, streaming deltas, function tools, multi-turn | Fully Supported |
| /v1/embeddings | POST | Single and batch vector generation for embeddings | Fully Supported |
| /v1/models | GET | Model catalogue listing in OpenAI standard format | Fully Supported |
| /v1/audio/transcriptions | POST | Speech-to-text audio transcriptions (Whisper API schema) | Fully Supported |
| /v1/images/generations | POST | Image generation prompt processing with signed media URLs | Fully Supported |
Real-Time Streaming
Token-by-Token Server-Sent Events (SSE)
Pass stream: true to receive incremental token updates as Server-Sent Events, significantly reducing time to first token for interactive applications:
TypeScript / JavaScript Streaming
const stream = await openai.chat.completions.create({
model: "deepseek-ai/DeepSeek-V4-Pro",
messages: [{ role: "user", content: "Write a short poem." }],
stream: true,
});
for await (const chunk of stream) {
const content = chunk.choices[0]?.delta?.content;
if (content) {
process.stdout.write(content);
}
}Python Streaming
stream = client.chat.completions.create(
model="deepseek-ai/DeepSeek-V4-Pro",
messages=[{"role": "user", "content": "Write a short poem."}],
stream=True,
)
for chunk in stream:
content = chunk.choices[0].delta.content
if content is not None:
print(content, end="", flush=True)Security & Billing
Authentication & Local DZD Billing
Standard Bearer Auth
Every request authenticates using standard HTTP Authorization Bearer tokens. When initializing the OpenAI client, pass your DEVUP AI API key directly via apiKey or environment variables.
Metered DZD Billing
All requests across chat, embeddings, and audio are billed in Algerian Dinar (DZD) based on token or duration usage. Top up balances directly via Edahabia or CIB cards without foreign currency constraints.
Start Building with the OpenAI SDK
Get your API key, configure your base URL, and leverage production foundation models in seconds.