> Keiro Labs API documentation - Quickstart
> Page: https://docs.keirolabs.ai/quickstart.html
> Markdown: https://docs.keirolabs.ai/quickstart.md
> Agent index: https://docs.keirolabs.ai/llms.txt
> API base URL: https://api.keirolabs.ai/v1
> Auth: send "Authorization: Bearer <api-key>" with a key created in the
> Keiro console (https://console.keirolabs.ai/api-keys). Use credentials saved by
> `keiro setup`, or resolve the key from a secret manager or an owner-only
> secret file and pass it to the client explicitly. Never read another
> provider's variable, and never put raw key material in environment
> variables, code, docs, or logs.

# Developer quickstart

Create a key, install one client, and print your first eb1 response. The Python
path below is copy-run complete and keeps the API key out of source code,
shared environment files, and shell history.

## 0. Get access

eb1 is in invite-only beta. Request access at the
[console request-access page](https://console.keirolabs.ai/request-access);
you will receive an invite email with a console login and a support channel.

## 1. Create an API key

Open [API Keys in the Keiro console](https://console.keirolabs.ai/api-keys),
choose **Create API key**, and give the key a workload-specific name.

The full secret is shown once. Save it in an approved password manager or
secret manager before closing the reveal. Do not paste it into this page, a
repository, a ticket, or a screenshot.

## 2. Install the OpenAI Python SDK

Use Python 3.11 or newer. A virtual environment keeps the install local to
this walkthrough and avoids the externally-managed-environment error on
system Pythons:

```bash
python3 -m venv .venv
source .venv/bin/activate
python3 -m pip install --upgrade openai
```

## 3. Create the request script

Save this as `quickstart.py`:

```python
from getpass import getpass

from openai import OpenAI

client = OpenAI(
    base_url="https://api.keirolabs.ai/v1",
    api_key=getpass("Keiro API key: "),
)

response = client.responses.create(
    model="eb1-preview",
    input="In one sentence, explain why idempotency matters.",
)

print(response.output_text)
```

`getpass()` reads the key without echoing it and passes it directly to this
client process. The script never stores the secret.

## 4. Run it

```bash
python3 quickstart.py
```

At the prompt, paste the key you saved. A successful run prints one generated
sentence, for example:

```text
Idempotency lets a safely retried operation return the original result without executing twice.
```

The wording varies. Success means the process exits normally and
`response.output_text` contains generated text.

## Raw HTTP alternative

Use this path to verify the exact request and response body without an SDK:

```bash
printf 'Keiro API key: '
IFS= read -rs KEIRO_BEARER
printf '\n'

curl -sS https://api.keirolabs.ai/v1/responses \
  -H "Content-Type: application/json" \
  -d '{
    "model": "eb1-preview",
    "input": "In one sentence, explain why idempotency matters."
  }' \
  -H @- <<<"Authorization: Bearer $KEIRO_BEARER"
```

The prompt works in both bash and zsh, and `-H @-` (curl 7.55 or newer) reads
the Authorization header from stdin so the secret never appears in the process
argument list.

In raw JSON, generated text appears in the assistant message's output content.
SDK `output_text` is the convenient aggregate of those text parts.

## Keiro CLI alternative

The native CLI stores credential metadata and owner-only secret files through
its setup flow:

```bash
python3 -m pip install --upgrade keiro
keiro setup
keiro "In one sentence, explain why idempotency matters."
```

Use this saved-credential path for later Keiro CLI and native-client work.

## Troubleshooting

| Symptom | Check |
|---|---|
| `401` | The key was copied completely, is still active, and belongs to the selected organization |
| `403` | The key or organization is not allowed to use the requested capability |
| `404` or model error | The base URL includes `/v1`, and `eb1-preview` appears in `GET /v1/models` for this key |
| `429` | Honor `Retry-After`; check account rate or spend limits before retrying |
| Connection or TLS failure | Check [Status and support](status-support.md) and confirm the exact public base URL |
| Python has no `output_text` | Upgrade the OpenAI SDK and inspect the raw `output` items for text content |

Do not solve an authentication failure by putting the key into a URL, command
argument, source file, or shared environment file.

## Next steps

- Hand setup to your coding agent with [Agent-driven setup](agent-setup.md).
- Run your coding agent on eb1: [Claude Code](claude-code.md),
  [Codex](codex.md), or [Omnigent](omnigent.md) — each is a dedicated key and
  a few minutes of setup.
- Building an application? Choose an endpoint in
  [API reference](api-reference.md) and compare public IDs in
  [Models](models.md).
- Migrating existing code? See [SDKs and CLI](sdks.md) and
  [Migration](migration.md).
- Before load testing: [Errors](errors.md), [Idempotency](idempotency.md),
  and [Usage and billing](usage-billing.md).
