S Stefan API Docs
Documentation v0 · Replace YOUR_HOST and YOUR_API_KEY only after confirming the current account route. Never paste a real key into public code.

Quick start

Connect your first AI API request.

The common setup pattern is simple: API key, base URL, model route, then one minimal request.

01

Create or receive a key

Use the approved account or console flow. Never expose the secret in screenshots, frontend code, or Git.

02

Set the base URL

Use the current gateway host confirmed for your account, normally ending in /v1.

03

Choose a mapped model

Model names must match the enabled route for the account and client.

04

Test minimally

Start with one small request before changing the whole workflow.

Current model availability, route names, limits, pricing, and data policies must be confirmed before use.

Tutorial center

Five setup guides you can use right away.

These are the first source files for the public setup path. They are short on purpose so customers can choose the right tutorial fast.

Codex Setup

Connect Codex with a base URL, key, mapped model, and one minimal request.

Open source file

Cursor Setup

Set the provider path, key, model, and version-aware client settings.

Open source file

Claude Code

Confirm the auth path, base URL, model route, and first test request.

Open source file

OpenAI-compatible SDK

Use the standard SDK pattern with a custom base URL and a minimal request.

Open source file

Quick Start Checklist

Send the shortest useful setup request and avoid exposing secrets.

Open source file
These guides are support assets, not a promise of universal compatibility. Confirm the current account route, limits, and client version before use.

Codex tutorial

Set up Codex with the smallest safe path.

Start with the confirmed base URL, a valid key, the mapped model, and one minimal request. Keep the first test simple.

01

Confirm the route

Check the current host, model route, and whether the account supports the intended path.

02

Enter the config

Use the supported Codex config or environment variable path for your version.

03

Test once

Run one short prompt to confirm the connection before doing anything larger.

04

Check common errors

Look first at base URL, key placement, model mapping, and account access.

Source file: 01_Codex_Setup_Tutorial.md

Cursor tutorial

Set up Cursor with the correct provider path.

Find the provider settings, set the gateway host, store the key safely, and test one request before expanding the workflow.

01

Find provider settings

Look for API provider, custom endpoint, or OpenAI-compatible model settings.

02

Set the base URL

Use the confirmed host ending in /v1.

03

Protect the key

Use a secret field or environment variable, not public code.

04

Test one prompt

Keep the first request small and verify the response before deeper use.

Source file: 02_Cursor_Setup_Tutorial.md

Claude tutorial

Set up Claude Code with a version-aware path.

Confirm whether you are using Anthropic login, a gateway route, or another supported setup path, then test one simple request.

01

Confirm auth path

Do not mix login flow and gateway settings unless the client supports that path.

02

Set env vars

Use the approved base URL and token variable for your installed version.

03

Choose the model

Use the mapped route name that matches the current account.

04

Run one prompt

Test the smallest possible request before any larger workflow.

Source file: 03_Claude_Code_Setup_Tutorial.md

SDK tutorial

Set up an OpenAI-compatible SDK.

This path works well when the SDK can read a key and an optional base URL, then make one minimal request.

01

Create the key

Use a valid API key and keep it on the server or in protected local config.

02

Set baseURL if needed

Point the SDK to the confirmed gateway host if the route is not the default provider.

03

Call one minimal request

Use one model and one short input to verify the path.

04

Check failures in order

Look at key, base URL, model name, account access, and SDK version.

Source file: 04_OpenAI_Compatible_Setup_Tutorial.md

Checklist tutorial

Use the quick start checklist before you ask for help.

If you do not know which setup file to read first, start here and send the shortest useful message.

01

Know your tool

Name the client or application you are using.

02

Know your goal

Describe what you are trying to make work.

03

Know the issue

Send the current error or the thing that is not working.

04

Ask for a test key

Say whether you need a limited validation key or just setup guidance.

Source file: 05_Quick_Start_Checklist.md

Model routes

Choose a model route carefully.

The platform snapshot shows model labels such as the examples below. These are observed labels, not a guaranteed live list for every account.

gpt-5.2gpt-5.4gpt-5.4-minigpt-5.5gpt-5.6gpt-5.6-lunagpt-5.6-solgpt-5.6-terragpt-image-2codex-auto-review
Before using a model route, confirm the current account permission, route name, pricing, limits, and intended client. Domestic-model support is not promoted publicly until supplier policy is confirmed in writing.

System setup

Choose the guide for your computer.

The same API can be configured differently depending on whether the customer is using Windows, macOS, or Linux. Start with the client you already use, then follow the setup path that matches your system.

01

Windows

Use environment variables or the client settings folder. Check the tool’s path and secret handling first.

02

macOS

Use the app settings or shell profile where the tool stores its credentials and configuration.

03

Linux

Use the shell profile, local config file, or project environment file depending on the tool version.

04

Rule

Never put a real key in a public repo or screenshot. If you are unsure, send Stefan the tool name and error.

System paths vary by client version. Confirm the exact file or environment variable name before making changes.

Codex

Configure Codex / Responses API

The observed setup uses a provider configuration with a Responses wire path. The exact schema depends on the installed client version.

Example configuration

model = "YOUR_MODEL"
model_provider = "stefan_gateway"

[model_providers.stefan_gateway]
name = "Stefan API"
base_url = "https://YOUR_HOST/v1"
env_key = "STEFAN_API_KEY"
wire_api = "responses"

Back up your existing configuration first. Prefer the client’s supported login or environment-variable flow when available.

Developer tools

Cursor and compatible tools

Many developer tools follow the same pattern: custom base URL, API key, and model route. The exact menu location depends on the tool version.

01

Find AI provider settings

Look for API provider, OpenAI-compatible provider, custom endpoint, or model settings.

02

Set the base URL

Use the confirmed gateway host ending in /v1.

03

Store the key safely

Use the tool's secret field or environment variable. Do not paste keys into public projects.

04

Test one request

Use a small prompt first. If it fails, send Stefan the tool name and error message.

Claude Code

Configure Claude Code

Use the gateway base URL and a protected authentication variable supported by your installed version.

ANTHROPIC_BASE_URL=https://YOUR_HOST/v1
ANTHROPIC_AUTH_TOKEN=YOUR_API_KEY

Some versions use ANTHROPIC_API_KEY. Confirm the client version and do not set both fields blindly.

Gemini CLI

Configure Gemini CLI

Custom base URL behavior depends on the current Gemini CLI version and gateway channel.

GEMINI_API_KEY=YOUR_API_KEY
GOOGLE_GEMINI_BASE_URL=https://YOUR_HOST/v1

Confirm that your installed client supports a custom base URL before changing the local configuration.

SDK

Use an OpenAI-compatible SDK

The gateway documentation describes common Python and Node.js patterns using a custom base URL.

from openai import OpenAI

client = OpenAI(
    api_key="YOUR_API_KEY",
    base_url="https://YOUR_HOST/v1"
)

response = client.chat.completions.create(
    model="YOUR_MODEL",
    messages=[{"role": "user", "content": "Hello"}]
)

Do not mix an upstream provider key with the gateway key.

Diagnosis

Run a minimal cURL test

Use a minimal request to separate address, key, model, quota, and client problems.

curl https://YOUR_HOST/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"YOUR_MODEL","messages":[{"role":"user","content":"Hello"}]}'

Check failures in this order: base URL, API key, model mapping, balance, client version, network, and request path.

Common errors

Check the error before changing everything.

Most setup problems come from a small set of repeatable issues. Start with the error category, then fix one thing at a time.

401 / Unauthorized

Check whether the key is correct, active, and stored in the right place. Verify that the customer is not mixing gateway keys with upstream keys.

Wrong base URL

Confirm the host and the /v1 path. A wrong address can make the request fail even when the key is valid.

Model not found

Make sure the model name matches an enabled route for the account and the client version.

Quota / balance issue

Check whether the account has balance, credits, or a valid plan. Ask Stefan before assuming it is a coding problem.

Client mismatch

Some tools require slightly different fields, environment variables, or base URL support. Check the installed version.

Network / TLS

If the address and key are correct, check firewall, VPN, certificate, or local network issues.

If the error is unclear, send the tool name and the exact message to Stefan instead of guessing.

Security notes

Keep API keys private.

Most setup problems can be solved without exposing secrets. Treat every key as a password.

  • Never put API keys in frontend code.
  • Never post keys in screenshots, logs, Git repositories, public chats, or public forms.
  • Use environment variables or protected local configuration.
  • Back up existing config before replacing it.
  • If a key is exposed, disable it and create a new one.
  • When asking Stefan for help, send the error message, not the secret key.