2026-02-03 18:40:51 +01:00
# Getting Started
2026-04-17 17:59:14 +02:00
## Try It Now (Demo Credentials)
You can test the client immediately using these public demo credentials — no sign-up required:
| | |
|---|---|
| **API key** | `NOMYO_AI_E2EE_INFERENCE` |
| **Model** | `Qwen/Qwen3-0.6B` |
> **Note:** The demo endpoint uses a fixed 256-token context window and is intended for evaluation only.
```python
import asyncio
from nomyo import SecureChatCompletion
async def main():
client = SecureChatCompletion(api_key="NOMYO_AI_E2EE_INFERENCE")
response = await client.create(
model="Qwen/Qwen3-0.6B",
messages=[{"role": "user", "content": "Hello!"}]
)
print(response['choices'][0]['message']['content'])
asyncio.run(main())
```
2026-02-03 18:40:51 +01:00
## Basic Usage
The NOMYO client provides end-to-end encryption (E2E) for all communications between your application and the NOMYO inference endpoints. This ensures that your prompts and responses are protected from unauthorized access or interception.
The NOMYO client provides the same interface as OpenAI's ChatCompletion API, making it easy to integrate into existing code.
The encryption and decryption process is causing overhead, thus inference speed will be lower compared to unencrypted inference. Using high and maximum security_tiers in the client request will add additional latency to the round-trip-time, but guarantees highest confidential use cases.
To minimize en-/decryption overhead the API is **none** -streaming. OpenAI API compatibily allows to set streaming=True in the request, but this will be ignored on the server side to allow maximum response token generation.
### Simple Chat Completion
```python
import asyncio
from nomyo import SecureChatCompletion
async def main():
# Initialize client
client = SecureChatCompletion(api_key="your-api-key-here")
# Simple chat completion
response = await client.create(
model="Qwen/Qwen3-0.6B",
messages=[
{"role": "user", "content": "Hello! How are you today?"}
],
temperature=0.7
)
2026-03-04 16:02:29 +01:00
# Extract what you need, then delete the response dict immediately.
# This minimises the time decrypted data lives in process memory
# (reduces exposure from swap files, core dumps, or memory inspection).
reply = response['choices'][0]['message']['content']
del response
print(reply)
2026-02-03 18:40:51 +01:00
asyncio.run(main())
```
### With System Messages
```python
import asyncio
from nomyo import SecureChatCompletion
async def main():
client = SecureChatCompletion(api_key="your-api-key-here")
response = await client.create(
model="Qwen/Qwen3-0.6B",
messages=[
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the capital of France?"}
],
temperature=0.7
)
print(response['choices'][0]['message']['content'])
asyncio.run(main())
```
## API Key Authentication
```python
import asyncio
from nomyo import SecureChatCompletion
async def main():
# Initialize with API key (recommended for production)
client = SecureChatCompletion(
api_key="your-api-key-here"
)
# Or pass API key in the create() method
response = await client.create(
model="Qwen/Qwen3-0.6B",
messages=[
{"role": "user", "content": "Hello!"}
],
api_key="your-api-key-here" # Overrides instance API key
)
asyncio.run(main())
```
## Security Tiers
The client supports different security tiers for controlling data protection levels:
```python
import asyncio
from nomyo import SecureChatCompletion
async def main():
client = SecureChatCompletion(api_key="your-api-key-here")
# Standard security tier (default)
response = await client.create(
model="Qwen/Qwen3-0.6B",
messages=[
{"role": "user", "content": "Hello!"}
],
security_tier="standard"
)
# High security tier for sensitive data
response = await client.create(
model="Qwen/Qwen3-0.6B",
messages=[
{"role": "user", "content": "What's my bank account balance?"}
],
security_tier="high" #enforces secure tokenizer
)
# Maximum security tier for classified data
response = await client.create(
model="Qwen/Qwen3-0.6B",
messages=[
{"role": "user", "content": "Share my personal medical records"}
],
security_tier="maximum" #HIPAA PHI compliance or other confidential use cases
)
asyncio.run(main())
```
## Using Tools
```python
import asyncio
from nomyo import SecureChatCompletion
async def main():
client = SecureChatCompletion(api_key="your-api-key-here")
response = await client.create(
model="Qwen/Qwen3-0.6B",
messages=[
{"role": "user", "content": "What's the weather in Paris?"}
],
tools=[
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get weather information",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string"}
},
"required": ["location"]
}
}
}
],
temperature=0.7
)
print(response['choices'][0]['message']['content'])
asyncio.run(main())
```
## Async Alias
The client also provides an `acreate` async alias for convenience:
```python
import asyncio
from nomyo import SecureChatCompletion
async def main():
client = SecureChatCompletion(api_key="your-api-key-here")
response = await client.acreate(
model="Qwen/Qwen3-0.6B",
messages=[
{"role": "user", "content": "Hello!"}
],
temperature=0.7
)
print(response['choices'][0]['message']['content'])
asyncio.run(main())
```
## Error Handling
```python
import asyncio
from nomyo import SecureChatCompletion, AuthenticationError, InvalidRequestError
async def main():
2026-04-11 17:16:24 +02:00
client = SecureChatCompletion(base_url="https://api.nomyo.ai")
2026-02-03 18:40:51 +01:00
try:
response = await client.create(
model="Qwen/Qwen3-0.6B",
messages=[
{"role": "user", "content": "Hello!"}
]
)
print(response['choices'][0]['message']['content'])
except AuthenticationError as e:
print(f"Authentication failed: {e}")
except InvalidRequestError as e:
print(f"Invalid request: {e}")
except Exception as e:
print(f"Other error: {e}")
asyncio.run(main())
```