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

# Getting started

> Set up QWED in your development environment. Covers backend server architecture, cloning, installing, and configuring LLM providers for verification.

Learn how to set up and run QWED in your development environment.

> [!WARNING]
>
> **Don't call your LLM directly.** QWED runs as a backend server with your LLM API keys configured in environment variables. See [Common pitfalls](https://docs.qwedai.tech/integration/common-pitfalls.md) for details.

***

## Architecture overview

QWED uses a **backend server model**:

```text theme={null}
Your application
  ↓ (SDK calls)
QWED backend server (you run this)
  ├─ Your LLM API key (from .env)
  ├─ LLM calls (OpenAI/Anthropic/etc)
  ├─ Formal verifiers (SymPy, Z3)
  └─ Returns verified result
```

***

## Step 1: Clone and install

```bash theme={null}
# Clone the repository
git clone https://github.com/QWED-AI/qwed-verification.git
cd qwed-verification

# Install Python dependencies
pip install -r requirements.txt
```

***

## Step 2: Configure LLM provider

QWED is **model agnostic** — select any LLM based on your needs:

### Create environment file

```bash theme={null}
# Copy example configuration
cp .env.example .env
```

### Select your LLM provider

Edit `.env` and add your API key for one provider:

> [tab] OpenAI
>
> ```bash theme={null}
> # .env
> ACTIVE_PROVIDER=openai
> OPENAI_API_KEY=sk-proj-...
> ```
>
> **Get an API key:** [https://platform.openai.com/api-keys](https://platform.openai.com/api-keys)

> [tab] Anthropic Claude
>
> ```bash theme={null}
> # .env
> ACTIVE_PROVIDER=anthropic
> ANTHROPIC_API_KEY=sk-ant-api03-...
> ```
>
> **Get an API key:** [https://console.anthropic.com](https://console.anthropic.com)

> [tab] Azure OpenAI
>
> ```bash theme={null}
> # .env
> ACTIVE_PROVIDER=azure_openai
> AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com/
> AZURE_OPENAI_API_KEY=...
> AZURE_OPENAI_DEPLOYMENT=gpt-4
> AZURE_OPENAI_API_VERSION=2024-02-01
> ```
>
> **Get Credentials:** [https://portal.azure.com](https://portal.azure.com) → Azure OpenAI Service

> [tab] Google Gemini
>
> ```bash theme={null}
> # .env
> ACTIVE_PROVIDER=gemini
> GOOGLE_API_KEY=AIzaSy...
> ```
>
> **Get an API key:** [https://makersuite.google.com/app/apikey](https://makersuite.google.com/app/apikey)

> [!TIP]
>
> For AWS Bedrock and more options, see [LLM configuration](https://github.com/QWED-AI/qwed-verification/blob/main/docs/LLM_CONFIGURATION.md).

***

## Step 3: Run the QWED backend server

```bash theme={null}
# Start the backend server
python -m qwed_api

# You should see:
# INFO: Uvicorn running on http://0.0.0.0:8000
```

**Keep this terminal running.** The server must stay active.

***

## Step 4: Install the SDK

In a **new terminal**, install the QWED SDK in your project:

> [tab] Python
>
> ```bash theme={null}
> pip install qwed
> ```

> [tab] TypeScript
>
> ```bash theme={null}
> npm install @qwed-ai/sdk
> ```

> [tab] Go
>
> ```bash theme={null}
> go get github.com/QWED-AI/qwed-verification/sdk-go/v9
> ```

***

## Step 5: Use the SDK

Connect your application to the local QWED backend:

> [tab] Python
>
> ```python theme={null}
> from qwed import QWEDClient
>
> # Connect to local backend
> client = QWEDClient(
>     api_key="qwed_local",  # Local auth key
>     base_url="http://localhost:8000"
> )
>
> # Verify a mathematical claim
> result = client.verify("Is 2+2 equal to 4?")
>
> print(result.verified)  # True
> print(result.evidence)  # {"calculated": 4, "claimed": 4}
> ```

> [tab] TypeScript
>
> ```typescript theme={null}
> import { QWEDClient } from '@qwed-ai/sdk';
>
> // Connect to local backend
> const client = new QWEDClient({
>   apiKey: 'qwed_local',
>   baseUrl: 'http://localhost:8000'
> });
>
> // Verify a mathematical claim
> const result = await client.verify('Is 2+2 equal to 4?');
>
> console.log(result.verified);  // true
> console.log(result.evidence);  // {calculated: 4, claimed: 4}
> ```

> [tab] Go
>
> ```go theme={null}
> package main
>
> import (
>     "context"
>     "fmt"
>     qwed "github.com/QWED-AI/qwed-verification/sdk-go/v9"
> )
>
> func main() {
>     client := qwed.NewClient("qwed_local", qwed.WithBaseURL("http://localhost:8000"))
>
>     result, err := client.Verify(context.Background(), "Is 2+2 equal to 4?")
>     if err != nil {
>         panic(err)
>     }
>
>     fmt.Println(result.Verified)  // true
> }
> ```

***

## Verify installation

Run this test to ensure everything is working:

> [tab] Python
>
> ```python theme={null}
> from qwed import QWEDClient
>
> client = QWEDClient(
>     api_key="qwed_local",
>     base_url="http://localhost:8000"
> )
>
> # Test 1: Math verification
> assert client.verify("2+2=4").verified == True
> print("✅ Math verification works!")
>
> # Test 2: Error detection
> assert client.verify("2+2=5").verified == False
> print("✅ Error detection works!")
>
> # Test 3: Code security
> result = client.verify_code("eval(user_input)", language="python")
> assert result.blocked == True
> print("✅ Security detection works!")
>
> print("\n🎉 QWED is working correctly!")
> ```

> [tab] TypeScript
>
> ```typescript theme={null}
> import { QWEDClient } from '@qwed-ai/sdk';
>
> const client = new QWEDClient({
>   apiKey: 'qwed_local',
>   baseUrl: 'http://localhost:8000'
> });
>
> async function testIntegration() {
>   // Test 1: Math verification
>   const result1 = await client.verify('2+2=4');
>   console.assert(result1.verified === true);
>   console.log('✅ Math verification works!');
>
>   // Test 2: Error detection  
>   const result2 = await client.verify('2+2=5');
>   console.assert(result2.verified === false);
>   console.log('✅ Error detection works!');
>
>   // Test 3: Code security
>   const result3 = await client.verifyCode('eval(user_input)', { language: 'python' });
>   console.assert(result3.blocked === true);
>   console.log('✅ Security detection works!');
>
>   console.log('\n🎉 QWED is working correctly!');
> }
>
> testIntegration();
> ```

***

## Next steps

Once your integration is working:

* [Common pitfalls](https://docs.qwedai.tech/integration/common-pitfalls.md) — avoid integration mistakes
* [Testing your integration](https://docs.qwedai.tech/integration/testing.md) — validate your setup
* [Production deployment](https://docs.qwedai.tech/integration/production.md) — deploy with confidence

***

## Troubleshooting

### Backend won't start

**Problem:**

```text theme={null}
Error: ANTHROPIC_API_KEY environment variable not set
```

**Solution:** Check your `.env` file has the correct API key for your selected provider.

***

### SDK can't connect

**Problem:**

```text theme={null}
Connection refused to http://localhost:8000
```

**Solution:**

1. Make sure backend is running (`python -m qwed_api`)
2. Check backend terminal for errors
3. Verify port 8000 is not blocked

***

### Wrong results

**Problem:** Verification results are incorrect or unexpected.

**Solution:**

1. Check which LLM provider you configured
2. Verify your API key is valid
3. See [Testing guide](https://docs.qwedai.tech/integration/testing.md) for detailed diagnostics

***

## Need help?

* [Community support](https://github.com/QWED-AI/qwed-verification/discussions)
* Email: [support@qwedai.tech](mailto:support@qwedai.tech)
* [Full documentation](https://docs.qwedai.tech)


## Related topics

- [Frequently asked questions](https://docs.qwedai.tech/faq.md)
- [QWED: deterministic verification for LLMs and AI agents](https://docs.qwedai.tech/intro.md)
- [Troubleshooting guide](https://docs.qwedai.tech/troubleshooting.md)
- [Changelog](https://docs.qwedai.tech/changelog.md)
- [QWED quick start for deterministic verification](https://docs.qwedai.tech/getting-started/quickstart.md)


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