# Generating API Keys

API keys allow you to access SoikaStack models programmatically through the REST API.

**Step 1: Navigate to API Settings**

1. Select **API Keys** in side nav bar and click on generate new api key.

![](https://soika-labs.gitbook.io/soika-mockingjay/~gitbook/image?url=https%3A%2F%2F2184813754-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252FBSwkgyDGOD52nsc2FrK2%252Fuploads%252FCXuGAzQg9UQYC5cWkKTs%252Fimage.png%3Falt%3Dmedia%26token%3Dd9995ed5-eedd-4cb9-9c37-f0cb60d599fe\&width=768\&dpr=4\&quality=100\&sign=16f3df21\&sv=2)

**Step 2: Create New API Key**

1. Click on the **Generate New API Key** button.
2. In the dialog that appears:
   * Enter a descriptive name for the API key (e.g., "Development Backend")
   * Select permissions for this key:
     * Expiration date (optional)
3. Click **Generate Key**.

**Step 3: Save Your API Key**

1. After generation, the system will display your new API key **only once**.
2. Copy this key and store it securely. It typically looks like: `sk_soika_7dJHG38djh38dJG83jdJG83jdJH83`.
3. Click **I've saved my key** to confirm.

> ⚠️ **Important**: The API key will only be shown once. If you lose it, you'll need to generate a new one.

**Step 4: Using Your API Key**

Your API key can now be used to access the SoikaStack API. Here's a basic example:

```
curl -X POST "http://[your-server-ip]:4142/v1/completions" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk_soika_your_api_key_here" \
  -d '{
    "model": "your_model_name",
    "prompt": "Once upon a time",
    "max_tokens": 100
  }'
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://soika-labs.gitbook.io/soika-mockingjay/soikastack-adding-llm-models-and-generating-api-keys/generating-api-keys.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
