{"id":28382,"library":"tensorzero","title":"TensorZero Python Client","description":"The Python client for TensorZero, an open-source platform for optimizing and evaluating LLM applications. Current version 2026.5.0, requires Python >=3.10. Released approximately monthly.","status":"active","version":"2026.5.0","language":"python","source_language":"en","source_url":"https://github.com/tensorzero/tensorzero","tags":["llm","inference","optimization","evaluation","ai-gateway"],"install":[{"cmd":"pip install tensorzero","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"TensorZero wraps OpenAI-compatible APIs and may use client internally","package":"openai","optional":true},{"reason":"Used for HTTP requests to the TensorZero gateway","package":"httpx","optional":false}],"imports":[{"note":"The main client class was historically named 'Client' but is now 'TensorZeroGateway' in modern versions.","wrong":"from tensorzero import Client","symbol":"TensorZeroGateway","correct":"from tensorzero import TensorZeroGateway"},{"note":"Direct import of inference function","symbol":"inference","correct":"from tensorzero import inference"}],"quickstart":{"code":"from tensorzero import TensorZeroGateway\n\n# Initialize client pointing to your TensorZero gateway\nclient = TensorZeroGateway(base_url='http://localhost:3000')\n\n# Make an inference\nresponse = client.inference(\n    function_name='chatbot',\n    input={\n        'messages': [\n            {'role': 'user', 'content': 'Hello!'}\n        ]\n    }\n)\n\nprint(response['output']['content'])","lang":"python","description":"Initialize TensorZero client and make a simple inference."},"warnings":[{"fix":"Ensure your gateway and UI authentication settings are consistent.","message":"Version 2026.5.0 changes UI authentication: when gateway requires auth, UI now also requires auth.","severity":"breaking","affected_versions":">=2026.5.0"},{"fix":"To restore synchronous writes, set `observability.async_writes = false` in gateway config.","message":"Version 2026.4.1 defaults to async observability writes, reducing tail latency.","severity":"breaking","affected_versions":">=2026.4.1"},{"fix":"Use `**` for recursive globbing, e.g., `--config-file **/*.toml`.","message":"Version 2026.2.2 changes config-file globbing: single-level wildcards no longer match across directories.","severity":"breaking","affected_versions":">=2026.2.2"},{"fix":"If you rely on caching, set `cache_options.enabled = 'write_only'` explicitly.","message":"Version 2026.2.1 changes default `cache_options.enabled` from `write_only` to `off`.","severity":"breaking","affected_versions":">=2026.2.1"},{"fix":"Nest evaluators under functions: `[functions.my_func.evaluators.exact_match]`.","message":"Legacy inference evaluations format (flat under `[evaluators]`) is deprecated since 2026.3.4.","severity":"deprecated","affected_versions":">=2026.3.4"},{"fix":"Use `model_name` and `provider_name` instead.","message":"The `model_provider_name` filter for `extra_body` and `extra_headers` was removed in 2026.3.1.","severity":"deprecated","affected_versions":">=2026.3.1"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Run `pip install tensorzero` in the correct Python environment (Python >=3.10).","cause":"Package not installed or installed in wrong environment.","error":"ModuleNotFoundError: No module named 'tensorzero'"},{"fix":"Use `from tensorzero import TensorZeroGateway` instead.","cause":"The client class was renamed from `Client` to `TensorZeroGateway` in a past breaking change.","error":"ImportError: cannot import name 'Client' from 'tensorzero'"},{"fix":"Ensure the config file exists and use `--config-file` with correct path (use `**/*.toml` for recursive search).","cause":"The gateway requires a configuration file (e.g., `tensorzero.toml`) in the specified path.","error":"tensorzero.config.ConfigError: config file not found"},{"fix":"Check the response status code and error message. Verify your input schema and ensure provider API keys are set.","cause":"Inference request failed due to invalid input, missing API keys, or provider errors.","error":"tensorzero.gateway.GatewayError: inference failed: ..."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}