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

# Developer quickstart

> Go from zero to your first Liquid API call in minutes: create an API key, install an SDK, and run a few lines of code.

The Liquid API gives you hosted access to Liquid models for text generation, vision, audio, and decisions. Chat models speak the OpenAI API, so the official OpenAI SDKs work with a new base URL. Get started by creating an API key and running your first API call.

## 1. Create and export an API key

Create an API key on the [API keys](https://console.liquid.ai/dashboard/api-keys) page of Liquid Console. If you don't have an account yet, sign up and join an organization first. The key is shown once, so store it somewhere safe. Keys belong to your organization and can be revoked at any time.

Export the key as an environment variable. Every example in these docs reads it from `LIQUID_API_KEY`.

> [tab] macOS / Linux
>
> ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
> export LIQUID_API_KEY="liquid_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
> ```

> [tab] Windows
>
> ```powershell theme={"theme":{"light":"github-light","dark":"github-dark"}}
> setx LIQUID_API_KEY "liquid_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
> ```

Requests carry the key as a bearer token. Check that it works by listing the models your organization can call:

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl https://api.liquid.ai/openai/v1/models \
  -H "Authorization: Bearer $LIQUID_API_KEY"
```

## 2. Install the OpenAI SDK and make an API call

Point the official OpenAI SDK at the Liquid API's base URL, `https://api.liquid.ai/openai/v1`.

> [tab] Python
>
> Install the SDK with pip:
>
> ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
> pip install openai
> ```
>
> Create a file called `example.py`, copy the example into it, and run it with `python example.py`:
>
> ```python highlight={7} theme={"theme":{"light":"github-light","dark":"github-dark"}}
> import os
>
> from openai import OpenAI
>
> client = OpenAI(
>     api_key=os.environ["LIQUID_API_KEY"],
>     base_url="https://api.liquid.ai/openai/v1",
> )
>
> completion = client.chat.completions.create(
>     model="lfm3-1.7b",
>     messages=[{"role": "user", "content": "Write a one-sentence bedtime story about a unicorn."}],
>     temperature=0.1,
>     extra_body={"top_k": 50, "repetition_penalty": 1.1},
> )
> print(completion.choices[0].message.content)
> ```

> [tab] JavaScript
>
> Install the SDK with npm:
>
> ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
> npm install openai
> ```
>
> Create a file called `example.mjs`, copy the example into it, and run it with `node example.mjs`:
>
> ```javascript highlight={5} theme={"theme":{"light":"github-light","dark":"github-dark"}}
> import OpenAI from "openai";
>
> const client = new OpenAI({
>   apiKey: process.env.LIQUID_API_KEY,
>   baseURL: "https://api.liquid.ai/openai/v1",
> });
>
> const completion = await client.chat.completions.create({
>   model: "lfm3-1.7b",
>   messages: [{ role: "user", content: "Write a one-sentence bedtime story about a unicorn." }],
>   temperature: 0.1,
>   // top_k and repetition_penalty are Liquid extensions to the OpenAI API
>   top_k: 50,
>   repetition_penalty: 1.1,
> });
> console.log(completion.choices[0].message.content);
> ```

> [tab] cURL
>
> ```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
> curl https://api.liquid.ai/openai/v1/chat/completions \
>   -H "Authorization: Bearer $LIQUID_API_KEY" \
>   -H "Content-Type: application/json" \
>   -d '{
>     "model": "lfm3-1.7b",
>     "messages": [{"role": "user", "content": "Write a one-sentence bedtime story about a unicorn."}],
>     "temperature": 0.1,
>     "top_k": 50,
>     "repetition_penalty": 1.1
>   }'
> ```

In a few moments you should see the model's reply. Replace `lfm3-1.7b` with any model id from the [Models](https://docs.liquid.ai/api/models.md) page.

## 3. Ask a decision model

Decision models answer typed questions about a state with calibrated probabilities instead of generated text. They have their own endpoint, which implements TypeSafe's System One API, so the official TypeSafe SDKs work with the base URL `https://api.liquid.ai/decisions`.

```bash theme={"theme":{"light":"github-light","dark":"github-dark"}}
curl https://api.liquid.ai/decisions/v1/systemone \
  -H "Authorization: Bearer $LIQUID_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "d1.1",
    "state": "Help! My payouts have been failing for 3 days.",
    "questions": {
      "department": {
        "type": "choice",
        "instructions": "Which team should handle this?",
        "criteria": { "billing": "Payments", "technical": "Bugs, outages", "sales": "Pricing" }
      },
      "is_urgent": { "type": "noul", "instructions": "Does this convey urgency?" }
    }
  }'
```

See [Decisions](https://docs.liquid.ai/api/guides/decisions.md) for the SDKs and every question type.

## Keep building

> [card] [Text generation](https://docs.liquid.ai/api/guides/text-generation.md)
>
> Stream replies, call tools, and get structured output.

> [card] [Vision](https://docs.liquid.ai/api/guides/vision.md)
>
> Send images to vision models.

> [card] [Audio and speech](https://docs.liquid.ai/api/guides/audio.md)
>
> Transcribe speech and get spoken replies.

> [card] [Batch](https://docs.liquid.ai/api/guides/batch.md)
>
> Process large request files asynchronously.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.