Docs

API reference

Chat

Text generation in three wire formats: OpenAI chat completions, the OpenAI Responses API, and Anthropic Messages. Same models, same key.

Base URL https://api.siliconnetwork.io

Chat Completions

silicon - zsh
curl -X POST https://api.siliconnetwork.io/v1/chat/completions \  -H "Authorization: Bearer sn_live_..." \  -H "Content-Type: application/json" \  -d '{  "model": "llama-3.2-3b",  "messages": [    {      "role": "user",      "content": "Say hello in one line."    }  ]}'
sdk.py
from siliconnetwork import SiliconNetwork client = SiliconNetwork()  # reads SILICON_API_KEYout = client.chat.completions.create(**{  "model": "llama-3.2-3b",  "messages": [    {      "role": "user",      "content": "Say hello in one line."    }  ]})print(out.choices[0].message.content, out.meta.request_id)
sdk.ts
import { SiliconNetwork } from "@siliconnetwork/sdk"; const client = new SiliconNetwork({ apiKey: process.env.SILICON_API_KEY });const out = await client.chat.completions.create({  "model": "llama-3.2-3b",  "messages": [    {      "role": "user",      "content": "Say hello in one line."    }  ]});console.log(out.choices[0].message.content, out.meta.requestId);
structured-output.py
from openai import OpenAI client = OpenAI(base_url="https://api.siliconnetwork.io/v1", api_key="sn_live_...") resp = client.chat.completions.create(    model="llama-3.2-3b",    messages=[{"role": "user", "content": "Give me a city and its country."}],    response_format={        "type": "json_schema",        "json_schema": {            "name": "place",            "strict": True,            "schema": {                "type": "object",                "properties": {"city": {"type": "string"}, "country": {"type": "string"}},                "required": ["city", "country"],                "additionalProperties": False,            },        },    },)print(resp.choices[0].message.content)  # valid JSON matching the schema, every time
forced-tool.py
resp = client.chat.completions.create(    model="llama-3.2-3b",    messages=[{"role": "user", "content": "What is the weather in Oslo?"}],    tools=[{        "type": "function",        "function": {            "name": "get_weather",            "parameters": {                "type": "object",                "properties": {"city": {"type": "string"}},                "required": ["city"],            },        },    }],    tool_choice={"type": "function", "function": {"name": "get_weather"}},)print(resp.choices[0].message.tool_calls[0].function.arguments)
response
{  "id": "chatcmpl_...",  "object": "chat.completion",  "model": "mlx-community/Llama-3.2-3B-Instruct-4bit",  "choices": [    {      "index": 0,      "message": { "role": "assistant", "content": "Hello." },      "finish_reason": "stop"    }  ],  "usage": {    "prompt_tokens": 9,    "completion_tokens": 2,    "total_tokens": 11,    "prompt_tokens_details": { "cached_tokens": 0 }  }}

Responses: 200 Successful Response, 422 Validation Error

Openai Responses

The OpenAI Responses shape. Structured output goes in text.format; tool_choice works the same as on chat completions.

silicon - zsh
curl -X POST https://api.siliconnetwork.io/v1/responses \  -H "Authorization: Bearer sn_live_..." \  -H "Content-Type: application/json" \  -d '{  "model": "llama-3.2-3b",  "input": "Say hello in one line."}'
request.py
from siliconnetwork import SiliconNetwork client = SiliconNetwork()data, meta = client.request("POST", "/v1/responses", json={  "model": "llama-3.2-3b",  "input": "Say hello in one line."})print(data, meta.request_id)

Responses: 200 Successful Response, 422 Validation Error

Claude Messages

Anthropic Messages shape. The key goes in Authorization: Bearer or in x-api-key, so an Anthropic SDK works with only its api key set.

silicon - zsh
curl -X POST https://api.siliconnetwork.io/v1/messages \  -H "Authorization: Bearer sn_live_..." \  -H "Content-Type: application/json" \  -d '{  "model": "llama-3.2-3b",  "max_tokens": 256,  "messages": [    {      "role": "user",      "content": "Say hello in one line."    }  ]}'
request.py
from siliconnetwork import SiliconNetwork client = SiliconNetwork()data, meta = client.request("POST", "/v1/messages", json={  "model": "llama-3.2-3b",  "max_tokens": 256,  "messages": [    {      "role": "user",      "content": "Say hello in one line."    }  ]})print(data, meta.request_id)
anthropic-sdk.py
from anthropic import Anthropic client = Anthropic(    base_url="https://api.siliconnetwork.io",    api_key="unused",    default_headers={"Authorization": "Bearer sn_live_..."},)msg = client.messages.create(    model="llama-3.2-3b",    max_tokens=256,    messages=[{"role": "user", "content": "Say hello in one line."}],)print(msg.content[0].text)

Responses: 200 Successful Response, 422 Validation Error

Silicon Network›Docs›API›Chat54 items