> ## Documentation Index
> Fetch the complete documentation index at: https://docs.valarhq.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart

> Start using Valar with OpenAI clients

The endpoint is the [OpenAI Responses API](/api-reference/responses-api/create-a-response) at `/v1/responses`, so any OpenAI-compatible client works after you change two settings: the base URL and the key.

This walkthrough runs one realistic task end to end: classifying an inbound support ticket and drafting a reply. You send it as a background job, then retrieve the result once Valar finishes. The same pattern scales from this single call to the thousands of concurrent requests an agent fans out at runtime.

<Steps>
  <Step title="Create an API key">
    Sign up at the [Valar Dashboard](https://app.valarhq.ai) and create an API key.
  </Step>

  <Step title="Point at Valar ">
    Install the OpenAI SDK and point it at Valar:

    1. Set the base URL to`https://api.valarhq.ai/v1`
    2. Pass the API key as a bearer token.

    ```python theme={"system"}
    from openai import OpenAI

    client = OpenAI(
        base_url="https://api.valarhq.ai/v1", # or read OPENAI_BASE_URL from the environment
        api_key="YOUR_VALAR_API_KEY",  # or read OPENAI_API_KEY from the environment
    )
    ```
  </Step>

  <Step title="Dispatch the task in the background">
    Setting `background` returns a response id immediately rather than holding the connection open. For one ticket this is convenient; across a queue of them it is what lets the work run concurrently. Use a model from the [Models](/models) page - here, `zai-org/GLM-5.2-FP8`.

    ```python theme={"system"}
    from openai import OpenAI

    client = OpenAI(
        base_url="https://api.valarhq.ai/v1", # or read OPENAI_BASE_URL from the environment
        api_key="YOUR_VALAR_API_KEY",  # or read OPENAI_API_KEY from the environment
    )

    ticket = (
        "Subject: Charged twice this month\n"
        "I see two identical $49 charges on the 3rd. Can you refund one and "
        "tell me why it happened?"
    )

    started = client.responses.create(
        model="zai-org/GLM-5.2-FP8",
        instructions=(
            "You are a support triage agent. Classify the ticket as one of "
            "billing, technical, or account, then draft a short reply."
        ),
        input=ticket,
        background=True,  # returns a response id right away to poll
    )

    print("Queued:", started.id)
    ```
  </Step>

  <Step title="Retrieve the result">
    The create call hands back a response id and a status of `queued` or `in_progress`. Retrieve that id until it reaches `completed`, then read `output_text`. In production you can replace this poll loop with a [webhook](/webhooks) so you aren't holding a thread per job.

    ```python theme={"system"}
    import time

    response = started
    while response.status in {"queued", "in_progress"}:
        time.sleep(2)
        response = client.responses.retrieve(response.id)

    if response.status != "completed":
        raise RuntimeError(f"Task ended as {response.status}")

    print(response.output_text)
    ```
  </Step>
</Steps>

## Going further

A single triaged ticket is the unit; an agent is many of them in a loop. From here:

* See [**Models**](/models) for the full list of supported models, and [**Pricing**](/pricing) for per-token rates.
* Turn this into a tool-using agent that looks up the customer's billing record before replying - see [Building a tool-calling agent](/agents).
* Run the same task over a backlog of tickets at once with [Requests at scale](/requests_at_scale), choosing a [completion window](/inference-modes#completion-windows) per the latency you can tolerate.

Questions about a specific workload can go to [support@valarhq.ai](mailto:support@valarhq.ai).
