SEMDOK Logo

SEMDOK

Platform Docs
← Main Site
Developer Technical Reference

SEMDOK Platform Connection Manual

Complete Technical Guide for Multi-Provider Inference, Model Combos, and Gateway Integration

1. System Overview

SEMDOK is an enterprise-grade multi-provider LLM gateway and inference routing platform. It consolidates heterogeneous AI providers (Google Gemini, OpenAI, Anthropic, DeepSeek, OpenCode, Moonshot) behind a unified, high-performance OpenAI-compatible interface.

Production Base URL: https://platform.semdok.com

The gateway handles schema transformation, connection pooling, automated failover ladders, admission backpressure, and real-time Server-Sent Events (SSE) streaming.

2. Authentication

SEMDOK enforces dual authentication models depending on the access layer:

Public Inference API Authentication

All calls to /v1/chat/completions, /v1/models, and /v1/combos require an API key generated in the SEMDOK Dashboard.

Authorization: Bearer sk-semdok-xxxxxxxxxxxxxxxxxxxxxxxx

Alternative headers supported:

Management Dashboard Authentication

Protected administrative endpoints (e.g. /api/combos, /api/providers) require a session cookie obtained via:

POST /api/auth/login
Content-Type: application/json

{"password": "<ADMIN_PASSWORD>"}

3. Core API Endpoints

Method Path Auth Model Description
POST /v1/chat/completions Bearer Token OpenAI-compatible chat completions interface (Streaming & Non-Streaming)
GET /v1/models Bearer Token Enumerates available provider models, virtual aliases, and combos
GET /v1/combos Bearer Token Public projected metadata of multi-model combos (capabilities & strategies)
GET /api/combos Session Cookie Full management view of combos with underlying connection weights and IDs
HEAD /v1/models None / Bearer Fast availability probe (RFC 9110 §9.3.2) returning headers only without hang

4. Chat Completions Specification

The primary inference endpoint matches the OpenAI Chat Completion v1 specification.

Request Headers

POST /v1/chat/completions HTTP/1.1
Host: platform.semdok.com
Content-Type: application/json
Authorization: Bearer YOUR_SEMDOK_API_KEY
Strict RFC 7231 Content-Type Guard: Requests must send Content-Type: application/json. Missing or text/plain headers are rejected immediately with HTTP 415.

Request Body

{
  "model": "gemini/gemini-2.5-flash",
  "messages": [
    { "role": "system", "content": "You are a helpful assistant." },
    { "role": "user", "content": "Explain quantum computing in one sentence." }
  ],
  "stream": true,
  "temperature": 0.7,
  "max_tokens": 512
}

Streaming Response (SSE)

data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1741500000,"model":"gemini/gemini-2.5-flash","choices":[{"index":0,"delta":{"content":"Quantum"},"finish_reason":null}]}

data: {"id":"chatcmpl-123","object":"chat.completion.chunk","created":1741500000,"model":"gemini/gemini-2.5-flash","choices":[{"index":0,"delta":{"content":" computing"},"finish_reason":null}]}

data: [DONE]

5. Combo Routing Engine

SEMDOK features a Combos Engine that aggregates multiple provider models into virtual meta-models with automatic fallback and load balancing.

Supported Routing Strategies

Common Presets Available in SEMDOK

Combo Identifier Strategy Primary Member Models
auto/best-fast Weighted gemini-2.5-flash, gemini-3.8-flash, gemini-3.6-flash, big-pickle
auto/gemini Priority gemini-2.5-flash, gemini-3.8-flash, gemini-3.7-flash
auto/best-coding Weighted antigravity-preview, gemini-3.7-flash, big-pickle
auto/best-reasoning Weighted deep-research-max, antigravity-preview, gemini-3.7-flash
big-pickle Priority oc/big-pickle (OpenCode Keyless Free Tier)

6. Verified Model Catalog

SEMDOK Model ID Target Provider Upstream Backbone Model
gemini/gemini-2.5-flash Google Generative AI gemini-2.5-flash
gemini/gemini-3.7-flash Google Generative AI gemini-3.7-flash
gemini/gemini-3.8-flash Google Generative AI gemini-3.8-flash
gemini/gemini-2.5-flash-lite Google Generative AI gemini-2.5-flash-lite
oc/big-pickle OpenCode AI big-pickle
auto/best-fast SEMDOK Combo Engine Multi-Model Fast Router

7. Error Codes & Diagnostics

HTTP Status Error Code / Type Root Cause & Remedy
401 Unauthorized invalid_api_key Missing, expired, or malformed Bearer token. Verify key in SEMDOK dashboard.
415 Unsupported Media Type unsupported_media_type Header Content-Type: application/json is required on all POST requests.
429 Too Many Requests rate_limit_exceeded SEMDOK token bucket quota exceeded or upstream provider rate limit triggered.
502 Bad Gateway upstream_failure Upstream provider failed and no fallback combo models were healthy.
503 Service Unavailable circuit_breaker_open Single-model circuit breaker tripped after consecutive upstream 5xx errors.

8. Multi-Language SDK & Code Examples

cURL (Bash)

curl -X POST "https://platform.semdok.com/v1/chat/completions" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_SEMDOK_API_KEY" \
     -d '{
       "model": "gemini/gemini-2.5-flash",
       "messages": [{"role": "user", "content": "Hello SEMDOK!"}],
       "stream": false
     }'

Python (Official OpenAI SDK)

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_SEMDOK_API_KEY",
    base_url="https://platform.semdok.com/v1"
)

response = client.chat.completions.create(
    model="gemini/gemini-2.5-flash",
    messages=[{"role": "user", "content": "Explain relativity briefly."}],
    stream=True
)

for chunk in response:
    content = chunk.choices[0].delta.content
    if content:
        print(content, end="", flush=True)

Node.js / JavaScript (OpenAI SDK)

import OpenAI from 'openai';

const openai = new OpenAI({
  apiKey: 'YOUR_SEMDOK_API_KEY',
  baseURL: 'https://platform.semdok.com/v1'
});

async function main() {
  const stream = await openai.chat.completions.create({
    model: 'gemini/gemini-2.5-flash',
    messages: [{ role: 'user', content: 'What is the speed of light?' }],
    stream: true,
  });

  for await (const chunk of stream) {
    process.stdout.write(chunk.choices[0]?.delta?.content || '');
  }
}

main();