Server-side integration guide
Integrate ProviderDock in the language you already use
JavaScript and TypeScript use the official provider-dock package. Python, Go, C#, Java, PHP, Ruby, and other server runtimes use the same secure OpenAI-compatible HTTPS endpoint.
Configure the workspace first
- Create a ProviderDock workspace and select the active organization.
- Create one customer tenant in the ProviderDock Console.
- Add the tenant's OpenAI, Anthropic, or Azure OpenAI credentials in the provider connections area.
- Create a tenant API token with only the
gateway:invokescope. - Store the token only in your server secret manager.
PROVIDERDOCK_API_KEY=pd_live_…
PROVIDERDOCK_MODEL=gpt-4.1-miniNever expose the token through NEXT_PUBLIC_, client-side JavaScript, browser storage, a desktop bundle, or a mobile application.
Choose your server language
Select a language to get a minimal production-safe starting point. JavaScript and TypeScript use the native SDK; every other example uses the same authenticated REST gateway.
npm install provider-dockimport ProviderDock from "provider-dock";
const providerDock = new ProviderDock({
apiKey: process.env.PROVIDERDOCK_API_KEY!
});
const response = await providerDock.responses.create({
model: process.env.PROVIDERDOCK_MODEL ?? "gpt-4.1-mini",
input: "Hello from TypeScript"
});
console.log(response.output_text);Keep PROVIDERDOCK_API_KEY in server-side secrets. Browser and mobile clients should call your authenticated application endpoint, never ProviderDock directly.
Tools, structured output, and routing policy
SDK 0.3.1 types function tools, structured response formats, provider capability requirements, provider order, and request-level failover control.
import ProviderDock from "provider-dock";
const providerDock = new ProviderDock({
apiKey: process.env.PROVIDERDOCK_API_KEY
});
const completion = await providerDock.chat.completions.create({
model: "gpt-4.1-mini",
messages: [{ role: "user", content: "Weather in Richmond?" }],
tools: [{
type: "function",
function: {
name: "lookup_weather",
parameters: { type: "object", properties: { city: { type: "string" } } },
strict: true
}
}],
tool_choice: "auto",
providerdock: {
allowed_providers: ["OPENAI", "AZURE_OPENAI"],
provider_order: ["AZURE_OPENAI", "OPENAI"],
require_capabilities: ["tools"],
allow_failover: true
}
});What the TypeScript SDK includes
providerDock.responses.create()providerDock.chat.completions.create()- Typed tools, structured outputs, model policies, and streaming tool-call deltas
- Async-iterable streaming responses
- Typed authentication, budget, rate-limit, provider, timeout, and connection errors
provider-dock/mocktest transport helpers- ESM, CommonJS, and TypeScript declarations
Production resources
Start with the language selector above, keep credentials server-side, and use the Prayer Companion guide as a real production example.