Nemo Router SDK — OpenAI-compatible client for the Nemo Router LLM gateway
Project description
Nemo Router SDKs
OpenAI-compatible SDKs for the Nemo Router LLM gateway. One key, one bill, 200+ models, built-in guardrails and prompt management.
SDKs
| Language | Package | Install | Status |
|---|---|---|---|
| Python | nemoroutersdk |
pip install nemoroutersdk |
Published |
| Node.js | @nemorouter/sdk |
npm install @nemorouter/sdk |
Ready |
| Go | github.com/nemorouter/nemorouter-go |
go get ... |
Ready |
| Java | com.nemorouter:sdk |
Maven | Ready |
| Ruby | nemorouter |
gem install nemorouter |
Ready |
| PHP | nemorouter/sdk |
composer require nemorouter/sdk |
Ready |
| cURL | None needed | Built-in | Examples |
Architecture
Every SDK is a thin wrapper around the language's OpenAI SDK. The magic happens server-side.
spec/nemo-sdk-spec.json ← Single source of truth
↓
sdks/
├── python/ ← pip install nemoroutersdk
├── node/ ← npm install @nemorouter/sdk
├── go/ ← go get github.com/nemorouter/nemorouter-go
├── java/ ← Maven Central
├── ruby/ ← gem install nemorouter
├── php/ ← composer require nemorouter/sdk
└── curl/ ← examples.sh (no install)
What Every SDK Does (Same Features, Every Language)
- Pre-configured —
base_urlandapi_key(fromNEMOROUTER_API_KEY) set automatically - Auto-captures metadata —
lastResponsepopulated with cost, guardrails, prompt version fromx-nemo-*headers - Typed errors —
GuardrailBlockedError,CreditError,RateLimitError(not generic 400/402/429) - Blocks unsupported endpoints —
audio,files,fine_tuning, etc. give clear errors, not confusing 404s - Nemo APIs —
credits.balance(),guardrails.list(),prompts.list(),nemoModels.pricing() - Prompt template override —
nemo_prompt_template_id+nemo_prompt_variablesper request
Keeping SDKs in Sync
All SDKs are driven by spec/nemo-sdk-spec.json:
{
"version": "0.1.0",
"response_headers": { "x-nemo-request-cost": { "type": "float" }, ... },
"errors": { "guardrail_blocked": { "http": 400, "class": "GuardrailBlockedError" }, ... },
"unsupported_endpoints": { "audio": "...", "files": "...", ... },
"nemo_apis": { "credits": { "balance": "/api/credits/balance" }, ... }
}
When the backend changes:
- Update
spec/nemo-sdk-spec.json - CI regenerates + publishes all SDKs
See How We Keep SDKs Updated below.
Quick Start (Every Language)
Python
from nemoroutersdk import NemoRouter
client = NemoRouter()
response = client.chat.completions.create(model="gpt-4o", messages=[{"role": "user", "content": "Hello!"}])
print(f"Cost: ${client.last_response.cost}")
Node.js
import { NemoRouter } from "@nemorouter/sdk";
const client = new NemoRouter();
const res = await client.chat.completions.create({ model: "gpt-4o", messages: [{ role: "user", content: "Hello!" }] });
Go
client := nemorouter.New()
resp, _ := client.Chat.Completions.New(ctx, openai.ChatCompletionNewParams{...})
fmt.Println(client.LastResponse.Cost)
Ruby
client = NemoRouter::Client.new
response = client.chat(parameters: { model: "gpt-4o", messages: [{ role: "user", content: "Hello!" }] })
PHP
$client = new \NemoRouter\NemoRouter();
$response = $client->chat()->create([...]);
Java
NemoRouter nemo = new NemoRouter();
ChatCompletion resp = nemo.openai().chat().completions().create(...);
cURL
curl https://api.nemorouter.com/v1/chat/completions \
-H "Authorization: Bearer $NEMOROUTER_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"gpt-4o","messages":[{"role":"user","content":"Hello!"}]}'
How We Keep SDKs Updated
Industry Standard (What OpenAI, Stripe, Anthropic Do)
| Company | Approach | Tool |
|---|---|---|
| OpenAI | OpenAPI spec → generated SDKs | Stainless |
| Anthropic | OpenAPI spec → generated SDKs | Stainless |
| Stripe | OpenAPI spec → generated SDKs | Custom generator |
| AWS | Smithy model → generated SDKs | Smithy |
| Google Cloud | Protobuf → generated SDKs | gapic-generator |
| Twilio | OpenAPI spec → generated SDKs | Custom generator |
The pattern is universal: one spec file → code generation → publish.
Our Approach
┌─────────────────────────────────────────┐
│ spec/nemo-sdk-spec.json │ ← YOU EDIT THIS
│ (headers, errors, APIs, version) │
└──────────────────┬──────────────────────┘
│
▼
┌─────────────────────────────────────────┐
│ scripts/generate-sdks.py │ ← READS SPEC
│ (validates + generates SDK code) │
│ │
│ For each language: │
│ 1. Read spec │
│ 2. Generate response meta class │
│ 3. Generate error classes │
│ 4. Generate unsupported blockers │
│ 5. Generate Nemo API helpers │
│ 6. Write to sdks/{lang}/ │
└──────────────────┬──────────────────────┘
│
▼
┌─────────────────────────────────────────┐
│ CI Pipeline (GitHub Actions) │
│ │
│ On spec change: │
│ 1. Regenerate all SDKs │
│ 2. Run tests per language │
│ 3. Version bump (from spec.version) │
│ 4. Publish: │
│ PyPI, npm, Maven, RubyGems, │
│ Packagist, Go module tag │
└─────────────────────────────────────────┘
What Triggers an Update
| Backend Change | Spec Update | SDK Impact |
|---|---|---|
| New response header | Add to response_headers |
All SDKs parse new header |
| New error code | Add to errors |
All SDKs get new error class |
| New Nemo API endpoint | Add to nemo_apis |
All SDKs get new method |
| New unsupported block | Add to unsupported_endpoints |
All SDKs block it |
| Version bump | Change version |
All packages publish same version |
| OpenAI adds new method | Nothing — inherited automatically | SDKs get it for free |
What DOESN'T Need an Update
| Change | Why No SDK Update |
|---|---|
| New model added | Just use model="new-model-name" — no SDK change |
| Guardrail config change | Dashboard config, not SDK |
| Prompt template change | Dashboard config, not SDK |
| Pricing change | Server-side, returned via nemoModels.pricing() |
| Rate limit change | Server-side enforcement |
| New provider key | Server-side routing |
This is the key advantage of the thin-wrapper approach: 90% of product changes need zero SDK updates.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nemoroutersdk-0.1.0.tar.gz.
File metadata
- Download URL: nemoroutersdk-0.1.0.tar.gz
- Upload date:
- Size: 9.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c6d34a3da9e779a4ae1f840c98ecf4eaaee929fc4529f2ddd7fd41fbca5e4ef
|
|
| MD5 |
1fed07ff5e8a4d8c4dfc5aa804e11cc2
|
|
| BLAKE2b-256 |
405edbb0ddd9301ca7f8baafe37ab0bb35de4859ebdebf72fc98010dccdf4f29
|
File details
Details for the file nemoroutersdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nemoroutersdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be08a42bd6bc5d380f6359f4e54346e3e8c7db3ade18215ccbfaf5b581c307ac
|
|
| MD5 |
96c3468a966001e9b98ccaed10afdb14
|
|
| BLAKE2b-256 |
ca485c69e2bd1a0ff5fa1f49fe2c21aecf96664013a1e853228478fbba6eca13
|