API Reference aktualisiert

Alpha Nerd 2026-04-18 15:43:22 +02:00
parent 752cc5c2c1
commit f2904ac301

@ -11,7 +11,8 @@ SecureChatCompletion(
base_url: str = "https://api.nomyo.ai", base_url: str = "https://api.nomyo.ai",
allow_http: bool = False, allow_http: bool = False,
api_key: Optional[str] = None, api_key: Optional[str] = None,
secure_memory: bool = True secure_memory: bool = True,
max_retries: int = 2
) )
``` ```
@ -21,6 +22,7 @@ SecureChatCompletion(
- `allow_http` (bool): Allow HTTP connections (ONLY for local development, never in production) - `allow_http` (bool): Allow HTTP connections (ONLY for local development, never in production)
- `api_key` (Optional[str]): Optional API key for bearer authentication - `api_key` (Optional[str]): Optional API key for bearer authentication
- `secure_memory` (bool): Enable secure memory protection (default: True) - `secure_memory` (bool): Enable secure memory protection (default: True)
- `max_retries` (int): Number of retries on retryable errors (429, 500, 502, 503, 504, network errors). Uses exponential backoff. Default: 2
### Methods ### Methods
@ -73,10 +75,30 @@ A dictionary containing the chat completion response with the following structur
"prompt_tokens": int, "prompt_tokens": int,
"completion_tokens": int, "completion_tokens": int,
"total_tokens": int "total_tokens": int
},
"_metadata": {
"payload_id": str,
"processed_at": int, # Unix timestamp
"is_encrypted": bool,
"response_status": str,
"security_tier": str, # "standard", "high", or "maximum"
"memory_protection": dict, # server-side memory protection info
"cuda_device": dict, # privacy-safe GPU info (hashed identifiers)
"tpm_attestation": { # TPM 2.0 hardware attestation (see Security Guide)
"is_available": bool,
# Present only when is_available is True:
"pcr_banks": str, # e.g. "sha256:0,7,10"
"pcr_values": dict, # {bank: {pcr_index: hex_digest}}
"quote_b64": str, # base64-encoded TPMS_ATTEST (signed by AIK)
"signature_b64": str, # base64-encoded TPMT_SIGNATURE
"aik_pubkey_b64": str, # base64-encoded TPM2B_PUBLIC (ephemeral AIK)
}
} }
} }
``` ```
The `_metadata` field is added by the client library and is not part of the OpenAI API response format. See the [Security Guide](security-guide.md) for how to interpret and verify `tpm_attestation`.
#### acreate(model, messages, **kwargs) #### acreate(model, messages, **kwargs)
Async alias for create() method. Async alias for create() method.
@ -92,13 +114,18 @@ The `SecureCompletionClient` class handles the underlying encryption, key manage
### Constructor ### Constructor
```python ```python
SecureCompletionClient(router_url: str = "https://api.nomyo.ai", allow_http: bool = False) SecureCompletionClient(
router_url: str = "https://api.nomyo.ai",
allow_http: bool = False,
max_retries: int = 2
)
``` ```
**Parameters:** **Parameters:**
- `router_url` (str): Base URL of the NOMYO Router (must use HTTPS for production) - `router_url` (str): Base URL of the NOMYO Router (must use HTTPS for production)
- `allow_http` (bool): Allow HTTP connections (ONLY for local development, never in production) - `allow_http` (bool): Allow HTTP connections (ONLY for local development, never in production)
- `max_retries` (int): Number of retries on retryable errors (429, 500, 502, 503, 504, network errors). Uses exponential backoff. Default: 2
### Methods ### Methods