Metadata-Version: 2.5
Name: veylox
Version: 0.1.0
Summary: One key. Every model. Paste any LLM API key and get a client for every model behind it.
Project-URL: Homepage, https://github.com/GirmadaShaw/veylox
Project-URL: Documentation, https://github.com/GirmadaShaw/veylox/tree/main/docs
Project-URL: Source, https://github.com/GirmadaShaw/veylox
Project-URL: Changelog, https://github.com/GirmadaShaw/veylox/blob/main/CHANGELOG.md
Author: Paramveer Singh
License-Expression: MIT
License-File: LICENSE
Keywords: ai,anthropic,api,claude,gemini,groq,llm,mistral,openai,openrouter
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx>=0.24
Provides-Extra: dev
Requires-Dist: build>=1.2; extra == 'dev'
Requires-Dist: mypy>=1.10; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23; extra == 'dev'
Requires-Dist: pytest>=7; extra == 'dev'
Requires-Dist: respx>=0.21; extra == 'dev'
Requires-Dist: ruff>=0.6; extra == 'dev'
Requires-Dist: twine>=5; extra == 'dev'
Provides-Extra: docs
Requires-Dist: mkdocs-material>=9.5; extra == 'docs'
Requires-Dist: mkdocstrings[python]>=0.25; extra == 'docs'
Description-Content-Type: text/markdown

# veylox

**One key. Every model.**

Paste in an API key from any major LLM provider. veylox works out which provider it belongs to and gives you a client for every model behind it, using the same simple methods no matter the provider.

```python
import veylox

client = veylox.connect("sk-ant-...")   # any supported key
print(client.provider)                  # "anthropic"

reply = client.chat("Explain recursion in one sentence.", model="claude-sonnet-4-5")
print(reply)
```

- **No provider setup.** The key decides the provider. No `"openai/..."` model prefixes, no per-provider SDKs.
- **Same methods everywhere.** `chat`, `stream`, `list_models`, `verify`, with async versions of each.
- **Clear errors.** Missing parameters are caught before any request is sent, and a mistyped model name comes back with "did you mean" suggestions.
- **Lightweight.** One dependency (`httpx`). Fully typed.
- **Safe by default.** Your full key never appears in printed objects, logs or error messages.

## Install

```bash
pip install veylox
```

Python 3.10 or newer.

## Supported providers

| Provider | Key looks like | `client.provider` |
|---|---|---|
| OpenAI | `sk-...`, `sk-proj-...` | `"openai"` |
| Anthropic | `sk-ant-...` | `"anthropic"` |
| Google Gemini | `AIza...` | `"gemini"` |
| Groq | `gsk_...` | `"groq"` |
| Mistral | 32 letters and digits | `"mistral"` |
| OpenRouter | `sk-or-...` | `"openrouter"` |

If your key has another format, tell veylox which provider it belongs to: `veylox.connect(key, provider="gemini")`.

## Usage

### Which provider is my key for?

```python
client = veylox.connect(key)
client.provider          # "groq"
client.provider_info     # ProviderInfo(id='groq', name='Groq', base_url='https://api.groq.com/openai/v1',
                         #              key_hint='gsk_...x9Q2', detected_by='prefix')

veylox.detect_provider("AIza...")   # "gemini", without making a client or a network call
```

### Chat

```python
reply = client.chat(
    [
        {"role": "system", "content": "You are a concise assistant."},
        {"role": "user", "content": "What is the capital of Japan?"},
    ],
    model="gpt-4o-mini",
    temperature=0.2,
    max_tokens=100,
)

reply.text            # "Tokyo."
reply.usage           # Usage(input_tokens=24, output_tokens=3, total_tokens=27)
reply.finish_reason   # "stop"
reply.raw             # the provider's full JSON response
```

`messages` can be a plain string (one user message) or a list of `{"role", "content"}` dicts. `model` is required. Everything else is optional:

| Parameter | Meaning |
|---|---|
| `system` | Instructions for the model |
| `max_tokens` | Maximum reply length (veylox sends 4096 to Anthropic if you leave it out, because Anthropic requires it) |
| `temperature` | Randomness: 0 is focused, higher is more creative |
| `top_p` | Nucleus sampling, 0 to 1 |
| `stop` | A string or list of strings that ends the reply |
| `**extra` | Any provider-specific option, passed through unchanged |

### Stream

```python
for chunk in client.stream("Write a short poem about the sea.", model="gemini-2.5-flash"):
    print(chunk, end="", flush=True)
```

### List models

```python
client.list_models()     # ['gpt-4o', 'gpt-4o-mini', ...]
```

### Check a key works

```python
client = veylox.connect(key, verify=True)   # raises AuthenticationError if the key is rejected
# or later:
client.verify()                             # True
```

### Async

Every method has an `_async` version:

```python
reply = await client.chat_async("Hi!", model="llama-3.3-70b-versatile")

async for chunk in client.stream_async("Hi!", model="llama-3.3-70b-versatile"):
    print(chunk, end="")

models = await client.list_models_async()
```

### Errors

Everything veylox raises inherits from `veylox.VeyloxError`:

```python
try:
    client.chat("Hi", model="gpt-4o-mnii")
except veylox.ModelNotFoundError as e:
    print(e.suggestions)        # ['gpt-4o-mini', ...]
except veylox.AuthenticationError:
    print("Bad or revoked key")
except veylox.PermissionDeniedError:
    print("Key is fine, but this model or region isn't allowed")
except veylox.RateLimitError:
    print("Slow down, or top up your quota")
except veylox.VeyloxError as e:
    print(e)
```

| Error | When |
|---|---|
| `UnknownKeyError` | The key's provider can't be detected |
| `InvalidRequestError` | A parameter is missing or invalid |
| `AuthenticationError` | The provider rejected the key |
| `PermissionDeniedError` | The key is valid but access was refused (model, plan or region) |
| `ModelNotFoundError` | The model doesn't exist (`.suggestions` has close matches) |
| `RateLimitError` | Too many requests, or out of quota |
| `ProviderError` | The provider failed, timed out, couldn't be reached, or the URL was wrong (404) |

## Documentation

The guides live in the [`docs/`](https://github.com/GirmadaShaw/veylox/tree/main/docs) folder and read fine on GitHub:

- [Getting started](https://github.com/GirmadaShaw/veylox/blob/main/docs/getting-started.md)
- [Keys and providers](https://github.com/GirmadaShaw/veylox/blob/main/docs/guide/providers.md)
- [Chatting](https://github.com/GirmadaShaw/veylox/blob/main/docs/guide/chat.md)
- [Streaming](https://github.com/GirmadaShaw/veylox/blob/main/docs/guide/streaming.md)
- [Models](https://github.com/GirmadaShaw/veylox/blob/main/docs/guide/models.md)
- [Async](https://github.com/GirmadaShaw/veylox/blob/main/docs/guide/async.md)
- [Handling errors](https://github.com/GirmadaShaw/veylox/blob/main/docs/guide/errors.md)

Every public function and class also has a full docstring, so `help(veylox.connect)` or your editor's hover shows the details.

To browse the full docs site, including the generated API reference, on your own machine:

```bash
pip install -e ".[docs]"
mkdocs serve        # then open http://127.0.0.1:8000
```

## License

MIT
