LightSwitch AI
Dashboard

QUICKSTART

Make your first request

LightSwitch exposes an OpenAI-compatible interface. Install the official SDK, then change the API key and base URL.

Using Cherry Studio, Cline, or Codex? Open the API / agent guides

Step 1

Create an API key

Step 2

Install the SDK

Step 3

Send a request

quickstart.py
from openai import OpenAI

client = OpenAI(
    api_key="sk-xxx",
    base_url="https://api.lightswitch.app/v1"
)

response = client.chat.completions.create(
    model="deepseek-chat",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Hello!"}
    ],
    temperature=0.7,
    max_tokens=1024
)

print(response.choices[0].message.content)

Authentication

Send your API key as a Bearer token with every request. The full key is shown only once at creation, so store it in a secret manager.

http
Authorization: Bearer sk-xxx

List available models

The model list reflects the providers and pricing currently enabled for your account.

bash
curl https://api.lightswitch.app/v1/models \
  -H "Authorization: Bearer sk-xxx"

Streaming responses

Set stream=true to receive incremental content over SSE in the same format expected by the OpenAI SDK.

python
stream = client.chat.completions.create(
    model="gpt-4.1-mini",
    messages=[{"role": "user", "content": "Explain SSE"}],
    stream=True,
)

for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")

Tool calling

The tools and tool_choice parameters are forwarded to providers that support function calling.

Deep thinking

Set reasoning_effort on models marked with the reasoning capability. Reasoning tokens count as output usage; the dashboard stores only the final answer, not private chain-of-thought.

python
response = client.chat.completions.create(
    model="gpt-5.6",
    messages=[{"role": "user", "content": "Analyze this carefully"}],
    reasoning_effort="high",
)

Image generation

Use the OpenAI Images SDK with an enabled image model. Size, quality, format, and count are limited to administrator-priced tiers; results are returned as b64_json.

python
image = client.images.generate(
    model="gpt-image-2",
    prompt="A clean product photograph of a teal keyboard",
    size="1024x1024",
    quality="medium",
    response_format="b64_json",
)

Errors and retries

CodeMeaning
400Invalid request
401Invalid or disabled API key
402Insufficient balance
429Rate or spend limit exceeded
502All providers temporarily unavailable

Ready to build?

Create your API key and explore the live model catalog.

Create account