> For the complete documentation index, see [llms.txt](https://docs.layerlens.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.layerlens.ai/more-in-this-section-9/public-client.md).

# Public client

`PublicClient` (sync) and `AsyncPublicClient` (async) cover read-only public endpoints. Access either via `client.public.*` on an authenticated `Stratix` or by instantiating directly. **Public access still requires an API key** — Stratix uses the key for rate-limit identification.

## Two ways to use

```python
# Via authenticated Stratix client
from layerlens import Stratix
client = Stratix()
public_models = client.public.models.get(query="claude")

# Standalone PublicClient
from layerlens import PublicClient
public = PublicClient()
models = public.models.get(companies=["OpenAI"])
```

## Models

```python
response = client.public.models.get(
 query="gpt", # text query
 name="gpt-4o", # exact name
 key="openai/gpt-4o", # exact key
 ids=["..."], # list of IDs
 categories=["transformer", "moe", "open-source", "closed-source", "usa", "china", "size-sm"],
 companies=["OpenAI", "Anthropic"],
 regions=["usa", "china"],
 licenses=["mit", "apache-2.0"],
 sizes=["size-sm", "size-md", "size-lg", "size-xl"],
 sort_by="releasedAt", # name, createdAt, releasedAt, architectureType, contextLength, license, region
 order="desc", # asc/desc
 page=1,
 page_size=50,
 include_deprecated=False,
)
# response.models,.categories,.companies,.regions,.licenses,.sizes,.count,.total_count
```

## Benchmarks

```python
benchmarks = client.public.benchmarks.get(...)
# benchmarks.datasets,.categories,.count,.total_count

# Get prompts for a benchmark (paginated)
prompts = client.public.benchmarks.get_prompts(
 benchmark_id="...",
 page=1, page_size=50,
 search_field="input", # id, input, truth
 search_value="reasoning",
 sort_by="createdAt",
 sort_order="asc",
)
# prompts.prompts,.count

# Auto-paginate
all_prompts = client.public.benchmarks.get_all_prompts(benchmark_id="...")
```

## Evaluations

```python
evaluation = client.public.evaluations.get_by_id("eval_abc")
# evaluation.summary.analysis_summary.key_takeaways

evaluations = client.public.evaluations.get_many(
 page=1, page_size=20,
 sort_by="submitted_at", order="desc",
 model_ids=["..."], benchmark_ids=["..."],
 status="success",
 unique=True,
)
```

## Comparisons

```python
# Compare two evaluations directly
comparison = client.public.comparisons.compare(
 evaluation_id_1="...",
 evaluation_id_2="...",
 page=1, page_size=20,
 outcome_filter="all", # "all", "both_succeed", "both_fail", "reference_fails", "comparison_fails"
 search="...",
)

# Or compare by models — auto-finds latest evaluations
comparison = client.public.comparisons.compare_models(
 benchmark_id="...",
 model_id_1="...",
 model_id_2="...",
)
```

## Discovery

The list responses expose available filter values:

```python
response = client.public.models.get()
print(response.categories) # available categories to filter by
print(response.companies) # available companies
print(response.regions)
```

## See also

* [Models and benchmarks](/more-in-this-section-9/models-benchmarks.md) — authenticated access for catalog management
* [Stratix Public](/6.-build-wire-your-code/sdk-python.md) — the dashboard surface


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.layerlens.ai/more-in-this-section-9/public-client.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
