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

# Introduction

> Getting started with Nuabase to make structured LLM API calls

Nuabase is an LLM runtime designed for the front-end. It allows you to turn natural language prompts into type-safe functions that you can call directly from your browser or client-side application.

## Why Nuabase?

Building LLM-powered features usually requires a significant amount of glue code:

1. **Backend API**: You can't expose LLM keys on the client, so you build a backend proxy.
2. **Validation**: You need to validate inputs and enforce structured outputs from the LLM.
3. **Infrastructure**: You need to handle queuing, retries, timeouts, and streaming.

Additionally, LLM prompts and responses are large, and shouldn't go in your operational database. But you still need
to maintain a store of records where you can inspect the logs for development and debugging.

Nuabase solves all this with an LLM runtime that lets you run prompts directly from the front-end.

<CardGroup cols={2}>
  <Card title="Type-Safe Functions" icon="code">
    Define a prompt and a Zod schema, and get a fully typed async function in return. 100% type guarantee.
  </Card>

  <Card title="Front-end Native" icon="browser">
    Call directly from React, Vue, or vanilla JS. Secure access via short-lived tokens.
  </Card>

  <Card title="Granular Caching" icon="bolt">
    Row-level caching means identical inputs return instantly and cost nothing.
  </Card>

  <Card title="Abuse Prevention" icon="shield-check">
    Built-in rate limiting, user budgets, and quotas per end-user.
  </Card>
</CardGroup>

## How it works

```typescript theme={null}
// 1. Define
const classify = nua.createFn({
  prompt: "Is this comment positive or negative?",
  output: { schema: z.enum(["POSITIVE", "NEGATIVE"]) }
});

// 2. Call
const result = await classify("I love this product!");

// 3. Receive
console.log(result.data); // "POSITIVE"
```

1. **Define**: You describe what you want (the prompt) and the shape of the data you expect (the schema).
2. **Call**: You invoke the function with data, just like a normal API call.
3. **Receive**: Nuabase processes the request (handling the LLM complexity) and returns validated JSON.

## Next Steps

<CardGroup cols={2}>
  <Card title="Quickstart" icon="play" href="/quickstart">
    Build your first LLM function in under 5 minutes.
  </Card>

  <Card title="Frontend Workflow" icon="laptop" href="/workflows/frontend">
    Learn how to securely integrate Nuabase in your web app.
  </Card>
</CardGroup>
