Skip to content

Configuration

Basic Options

from pyudskit import UDS

uds = UDS(
    api_key="sk-ant-...",
    model="claude-sonnet-4-20250514",
    verbose=False,
)
  • api_key: overrides ANTHROPIC_API_KEY.
  • model: choose an Anthropic model.
  • verbose: prints raw LLM output for debugging.

Session State

pyudskit tracks ECU context automatically:

uds.switch_session("extended")
uds.security_access_seed(level=1)
print(uds.ecu_state)

Advanced Overrides

If you need a fresh context:

uds.clear_session()

OEM Profile (Straightforward)

Load an OEM profile so services, DIDs, routines, and DTCs match your ECU:

from pyudskit import UDS

uds = UDS(profile="pyudskit/profiles/oem_example.json")

print(uds.list_services())   # merged with OEM services
print(uds.list_dids())       # merged with OEM DIDs
print(uds.explain_dtc("P0301"))  # OEM DTC if present

You can also load a dict at runtime:

profile = {
    "name": "my_ecu",
    "dids": {"0xF190": {"name": "VIN", "length_bytes": 17}},
    "services": {"0x27": {"name": "SecurityAccess"}},
    "dtcs": {"P0301": {"name": "Cylinder 1 Misfire", "severity": "medium"}},
}
uds.load_profile(profile)
  • API Reference → AI Client
  • API Reference → Services
  • API Reference → Transport
  • API Reference → Async
  • API Reference → CLI
  • API Reference → OEM Profiles

Testing

Use the test fixtures in tests/conftest.py to mock LLM responses.