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

# Coded Apps

> Learn how to register, connect, and manage your custom code applications within Kosmoy Studio using Coded Apps and the Kosmoy SDK.

# Working with Coded Apps

**Coded Apps** in Kosmoy Studio provide a way to integrate your existing code artifacts (like Python-based chatbots or AI applications) with the Kosmoy platform. By registering a Coded App and using the **Kosmoy SDK** in your codebase, you can connect your application to a **Kosmoy Gateway** and leverage powerful features like **Guardrails**, **Routers**, and the **Insights** section for monitoring and observability.

## Creating a Coded App

1. **Navigate to Coded Apps:** From the Kosmoy Studio home page, click on the **"Apps"** menu in the left-hand navigation bar, then select **"Coded Apps"**.

2. **Add a New Coded App:** Click the **"+ ADD"** button located in the upper right corner of the Coded Apps section.

3. **Select a Gateway:** Choose the **Gateway** that your Coded App will connect to. This Gateway defines the models, routers, and guardrails that your application can access.

4. **Name and Describe the Coded App:** Give your Coded App a unique name and an optional description.

5. **Click "Review":** Review the Coded App configuration.

6. **Click "Create":** Register the Coded App.

## API Key Generation and Usage

Upon creating a Coded App, Kosmoy Studio automatically generates an **App ID** and an **API key**. These credentials are used by the Kosmoy SDK to authenticate your application and establish a connection to the assigned Gateway.

**Modal Display:** A modal will appear immediately after creation, displaying the App ID and API key. You can copy these credentials for use in your application's code.

**Important:** Store your API key securely. Do not share it publicly or commit it to version control.

**Regenerating the API Key:**

If you need to regenerate the API key for security reasons:

1. **Navigate to Coded Apps:** Go to **"Apps"** > **"Coded Apps"**.
2. **Locate the Coded App Card:** Find the card for your Coded App.
3. **Click on the Card:** This will take you to the Coded App details page.
4. **Find the "API Key" Panel:** Locate the panel displaying the current (obfuscated) API key.
5. **Click "Regenerate API Key":** This will trigger a confirmation modal.
6. **Confirm Regeneration:** The modal warns you that the old API key will be invalidated. Confirm that you want to proceed.
7. **Copy the New API Key:** The modal will reappear, displaying the newly generated API key. Copy this key for use in your application.

## Coded App Cards

The Coded Apps section displays each registered Coded App as a card. Each card shows:

* **Coded App Name:** The name you assigned to the Coded App.
* **Description:** The description you provided for the Coded App.
* **Edit Icon (Pencil):** Click this icon to update the Coded App's name, description, or assigned Gateway.
* **Delete Icon (Trash Bin):** Click this icon to remove the Coded App.

## Managing Coded Apps

### Updating a Coded App

You can update the name, description, and the assigned Gateway of a registered Coded App.

1. **Navigate to Coded Apps:** Go to **"Apps"** > **"Coded Apps"**.
2. **Locate the Coded App Card:** Find the card for the Coded App you want to update.
3. **Click the Edit (Pencil) Icon:** This will open the update dialog.
4. **Modify Parameters:** Update the Coded App's name, description, or select a different Gateway.
5. **Click "Save":** Save the changes.

**Warning:** Changing the Gateway can affect your application's functionality. Ensure that the new Gateway provides access to the necessary models and resources. You will be presented with a warning if you try to modify a coded app.

### Removing a Coded App

You can remove a registered Coded App if it's no longer needed.

1. **Navigate to Coded Apps:** Go to **"Apps"** > **"Coded Apps"**.
2. **Locate the Coded App Card:** Find the card for the Coded App you want to remove.
3. **Click the Delete (Trash Bin) Icon:** This will trigger a confirmation prompt.
4. **Confirm Deletion:** Confirm that you want to delete the Coded App.

**Warning:** Deleting a Coded App is a permanent action and cannot be undone.

## Connecting to a Gateway with the Kosmoy SDK

To connect your Coded App to its assigned Gateway, you'll use the **Kosmoy SDK** in your Python code. The SDK provides the necessary functions for authenticating your application and interacting with the Gateway.

**For detailed instructions and examples on using the Kosmoy SDK, refer to the [Kosmoy SDK Documentation](/kosmoy-sdk/introduction).**

## Monitoring Coded Apps

You can monitor the performance, usage, and costs associated with your Coded Apps through the **Insights** section of Kosmoy Studio. This provides valuable data for optimizing your applications and understanding their behavior.
