Guides
- Quickstart
- Quickstarts by language
- Migration guides
- Authentication and keys
- Key protection
- Models, aliases and fallbacks
- Automatic model choice (silicon/auto)
- Chat completions
- Streaming
- Structured outputs and tools
- Logprobs
- Vision
- Responses, Claude and Ollama
- Embeddings, rerank, audio, images
- Files and batches
- Documents and search
- LoRA adapters
- Project tags and costs
- Prefix caching
- Headers, rate limits and spend caps
- Errors
- Versioning and the sandbox
- Privacy and retention
- Verifiable receipts
- Data residency
- Pricing
- Billing
- Pay per request (x402)
- On-chain oracle
- Agent credit (backed compute lines)
- Status
- SDKs
- Swift SDK
- Integrations
- Run a node
- Linux agent
- Mac mini fleets
- Compute API
- Architecture
- Changelog
- Glossary
API reference
Migration guide
Migrate from OpenAI
Keep the official openai package. Point it at Silicon Network, give it a Silicon Network key, and pick an open weight model.
What changes
| OpenAI | Silicon Network | |
|---|---|---|
| Base URL | https://api.openai.com/v1 (the default) | https://api.siliconnetwork.io/v1 |
| Key | sk-... | sn_live_..., from the API Keys page |
| Models | gpt-4o-mini, text-embedding-3-small, ... | llama-3.2-3b, llama-3.1-8b, gpt-oss-120b, fast, best, bge-m3, ... |
| Client | openai (Python, Node) | the same package, unchanged |
Python
from openai import OpenAI client = OpenAI() # reads OPENAI_API_KEY resp = client.chat.completions.create( model="gpt-4o-mini", messages=[{"role": "user", "content": "Say hello in one line."}],)print(resp.choices[0].message.content)import os from openai import OpenAI client = OpenAI( base_url="https://api.siliconnetwork.io/v1", api_key=os.environ["SILICON_API_KEY"],) resp = client.chat.completions.create( model="llama-3.1-8b", messages=[{"role": "user", "content": "Say hello in one line."}], extra_body={"models": ["fast"]}, # optional: fall back to any fast model)print(resp.choices[0].message.content) # streaming works as beforestream = client.chat.completions.create( model="llama-3.1-8b", messages=[{"role": "user", "content": "Write a haiku about silicon."}], stream=True,)for chunk in stream: if chunk.choices: print(chunk.choices[0].delta.content or "", end="", flush=True)print()Silicon Network fields that the OpenAI SDK does not know (models fallback lists, quality, enable_thinking, metadata.project) go in extra_body in Python and as extra fields in Node.
TypeScript
import OpenAI from "openai"; const client = new OpenAI(); // reads OPENAI_API_KEY const res = await client.chat.completions.create({ model: "gpt-4o-mini", messages: [{ role: "user", content: "Say hello in one line." }],});console.log(res.choices[0].message.content);import OpenAI from "openai"; const client = new OpenAI({ baseURL: "https://api.siliconnetwork.io/v1", apiKey: process.env.SILICON_API_KEY,}); const res = await client.chat.completions.create({ model: "llama-3.1-8b", messages: [{ role: "user", content: "Say hello in one line." }],});console.log(res.choices[0].message.content);Without touching the code
Both official SDKs read their base URL and key from the environment when the code does not pass them, so an app that calls OpenAI() with no arguments can move by configuration alone. The model names in the code still have to change, unless they come from configuration too.
export OPENAI_BASE_URL=https://api.siliconnetwork.io/v1export OPENAI_API_KEY=sn_live_...Responses, embeddings and the rest
The Responses API is at /v1/responses, with the same client call. Embeddings, rerank, audio transcription and speech, image generation and edits, Files, Batch and vector stores follow the OpenAI shapes too.
import os from openai import OpenAI client = OpenAI(base_url="https://api.siliconnetwork.io/v1", api_key=os.environ["SILICON_API_KEY"]) resp = client.responses.create( model="gpt-oss-120b", instructions="Answer in one sentence.", input="Why is the sky blue?",)print(resp.output_text) emb = client.embeddings.create(model="bge-m3", input=["first text", "second text"])print(len(emb.data), len(emb.data[0].embedding))An embedding model answers only while one is loaded: check GET /v1/models for bge-m3 before you move an embedding pipeline.
What does not carry over
| OpenAI | Instead |
|---|---|
| POST /v1/completions (legacy text completions) | Use /v1/chat/completions with one user message. |
| GET /v1/models/{model} (models.retrieve) | GET /v1/models lists every model; find the id in it. |
| POST /v1/moderations | No moderation route. |
| Assistants, threads and runs | Responses, or chat with your own state. |
| Fine-tuning jobs | Not offered as a job API. For serving a LoRA adapter, see LoRA adapters in the guides. |
| POST /v1/audio/translations | Transcribe with /v1/audio/transcriptions. |
| POST /v1/images/variations | Use /v1/images/edits. |
| Realtime | Not offered. Stream chat completions instead. |
Parameters that behave differently
logit_bias, n above 1 and parallel_tool_calls: false are refused with a 400 that names the parameter, rather than ignored. Sampler values out of range (for example temperature above 2) are refused too. An output length above 8,192 tokens is clamped to 8,192, and 8,192 is sent when you set none. See Chat completions.
Checklist
| Step | Done when |
|---|---|
| Create a key and add balance | A key from the API Keys page; balance on the Billing page. |
| Change the base URL and key | The client sends to https://api.siliconnetwork.io/v1. |
| Map each model name | Every model in your code or config is in GET /v1/models, or is fast or best. |
| Remove routes that do not carry over | No legacy completions, moderations, assistants or models.retrieve calls. |
| Handle 402 and 429 | Out of credits and rate limits are caught and logged with Silicon-Request-Id. |
| Compare answers | Your own prompts give acceptable answers on the new models. |