API Reference
Integrate Wiser Lab's secure multi-node gateway into your automated production environments with minimal configuration.
Authentication
The Wiser Lab API uses Bearer tokens to authenticate requests. You can generate and rotate these keys securely inside your Profile dashboard.
Base URL
All gateway request mappings share a standardized public endpoint structure. Strip away upstream route complexities and address the secure proxy matrix directly.
Create Chat Completion
Proxy requests effortlessly using standard OpenAI-structured JSON schema payloads. Wiser Lab dynamically validates credentials, optimizes processing overhead, and executes models natively down to isolated computing nodes.
Request Parameters
| model | string — Required. The system routing model identifier (e.g., wiser-core-ultra). |
| messages | array — Required. A list of message objects representing the conversation history. |
| stream | boolean — Optional. Defaults to false. If true, server-sent events will be initialized. |
curl -X POST https://api.wiserlab.ai/v1/chat/completions \
-H "Authorization: Bearer wsl-..." \
-H "Content-Type: application/json" \
-d '{
"model": "wiser-core-ultra",
"messages": [
{"role": "user", "content": "Hello"}
],
"stream": true
}'
import openai
client = openai.OpenAI(
api_key="wsl-...",
base_url="https://api.wiserlab.ai/v1"
)
response = client.chat.completions.create(
model="wiser-core-ultra",
messages=[{"role": "user", "content": "Hello"}],
stream=True
)
for chunk in response:
print(chunk.choices[0].delta.content or "", end="")
Streaming Native Architecture
Wiser Lab bypasses typical intermediate buffer overhead. By toggling stream: true, the proxy network leverages asynchronous Python streams to safely pipe server-sent chunk records straight back to client runtimes as they compute.
Responses adhere strictly to the standard text/event-stream content protocol, ending execution sequences cleanly with a final data: [DONE] packet.
Error Codes
The gateway leverages explicit HTTP status headers alongside programmatic payload responses to map exceptions gracefully.
| Status Code | Type | Description |
|---|---|---|
| 401 Unauthorized | invalid_api_key | The Bearer token passed is inactive, malformed, or missing entirely. |
| 405 Method Not Allowed | invalid_http_method | The targeted endpoint restricts mutations to POST. Review routing protocols. |
| 502 Bad Gateway | node_timeout | Node 1 was unable to establish connection parameters back into isolated Node 2 subnets. |
Editor & CLI Tool Integration
Wiser Lab acts as a drop-in replacement for standard API endpoints. You can easily configure popular coding assistants and CLI tools to route their requests through our secure gateway by overriding their default environment variables. Below are detailed instructions for configuring OS variables and mapping supported models.
export commands to your ~/.bashrc or ~/.zshrc file to make them permanent. For Windows, configure them globally via your System Environment Variables GUI.
1. Claude Code
Claude Code natively utilizes Anthropic's SDK mapping. Override the base URL and pass your Wiser Lab key as the Anthropic key.
Linux / macOS (Terminal)
Windows (PowerShell)
claude --model wiser-core-ultra
2. OpenCode
OpenCode leverages OpenAI's routing schema. Ensure you append /v1 to the base URL parameter for full compatibility.
Linux / macOS (Terminal)
Windows (PowerShell)
~/.opencode/config.json) and set your desired default model:"default_model": "wiser-core-ultra"
3. Codex & Legacy OpenAI Tools
Some older generation tools like Codex utilize OPENAI_API_BASE instead of the modern base URL nomenclature.