Launchdock

repository·main·Indexed 43 days ago

https://github.com/nghyane/launchdock

A local gateway that allows developers to use Claude and GPT models across various AI coding tools through a single endpoint. It provides OpenAI-compatible and Claude-native API surfaces, manages authentication centrally, and supports tools such as claude-code, codex, opencode, droid, and pi.

Tokens
6.2K
Snippets
23
Records
39
Agent score
55%

What's inside Launchdock

  1. Use Claude thinking aliases for OpenAI-compatible clients

    main

    If you are using an OpenAI-compatible client that does not reliably serialize Claude's specific thinking configuration, use these model aliases. They automatically enable Claude thinking for you.

    Supported aliases:

    • claude-sonnet-4-6-thinking
    • claude-opus-4-6-thinking
    # Example: Use the alias in your client configuration
    # instead of the standard model name
    MODEL_NAME="claude-sonnet-4-6-thinking"
  2. Quickstart with launchdock

    main

    To get started, log in to your Claude and OpenAI accounts, start the local runtime, and launch a supported tool. The launchdock launch <tool> command automates credential checking, runtime startup, and configuration writing.

    # Authenticate
    launchdock auth login claude
    launchdock auth login openai
    
    # List active auth sessions
    launchdock auth list
    
    # Start the local gateway
    launchdock start
    
    # Launch a specific tool (e.g., opencode) with config generation
    launchdock launch opencode --config
  3. Push authentication to a personal server

    main

    You can push your managed credentials to a remote host. The auth push command automatically installs or updates launchdock on the remote host and imports your credentials. You can then start the runtime on that server via SSH.

    # Push credentials to a remote server
    launchdock auth push user@server.example.com
    
    # Start the runtime on the remote server
    ssh user@server.example.com '$HOME/.local/bin/launchdock start'
  4. Install launchdock

    main

    Install launchdock using the official installation script. You can also specify a version or a custom installation directory using environment variables.

    # Standard installation
    curl -fsSL https://raw.githubusercontent.com/nghyane/launchdock/main/install.sh | sh
    launchdock version
    
    # Install a specific version
    curl -fsSL https://raw.githubusercontent.com/nghyane/launchdock/main/install.sh | env LAUNCHDOCK_VERSION=v0.1.1 sh
    
    # Install to a custom directory
    curl -fsSL https://raw.githubusercontent.com/nghyane/launchdock/main/install.sh | env INSTALL_DIR=/usr/local/bin sh
  5. Authenticate with Claude or OpenAI

    main

    Use the auth login command to sign in through the native Claude or OpenAI login flows. This manages credentials locally so you can reuse them across multiple tools and personal servers without manually copying API keys.

    launchdock auth login claude
    launchdock auth login openai
  6. Validate launch readiness and credentials

    main

    Before launching a tool, launchdock performs readiness checks. If these checks fail, the process will exit with an error message.

    Requirements

    1. Credentials: The LaunchConfig must contain valid credentials (HasCreds). If credentials are missing, you are typically prompted to run: launchdock auth login <provider>.
    2. Provider Credentials: The specific provider required by the tool (e.g., anthropic) must have credentials present in the configuration or environment variables.
    3. Tool Installation: The tool's binary must be found in your system's PATH. If a tool is not installed, launchdock will report it as not found and suggest installing it.
  7. The Tool abstraction in launchdock

    main

    In launchdock, a Tool represents an external CLI application (like claude-code or codex) that can be configured and executed using the project's centralized LaunchConfig. Each tool defines how it should be configured on the local filesystem and how its execution arguments and environment variables should be constructed.

    Key fields of the Tool struct:

    • Name: The identifier for the tool.
    • Desc: A description of the tool.
    • Binary: The actual executable name used in the system path.
    • Provider: The underlying AI provider (e.g., anthropic, openai).
    • Config: A function used to write configuration files to the user's home directory (e.g., .codex/config.toml or .config/opencode/opencode.json).
    • ExecArgs: A function that returns the command-line arguments and environment variables required to run the tool with a specific model.
  8. Reference the launchdock API endpoints and semantics

    main

    The local gateway runs on http://localhost:8090. It supports three primary API surfaces depending on your client's requirements:

    EndpointGPTClaudeSemantics
    /v1/chat/completions✅✅OpenAI-compatible chat
    /v1/responses✅✅Native OpenAI Responses semantics
    /v1/messages—✅Native Claude Messages format

    Endpoint Details

    /v1/chat/completions

    • Standard OpenAI-compatible chat chunks.
    • Reasoning/thinking is exposed via choices[].delta.reasoning_content.
    • Best for broad client compatibility.

    /v1/responses

    • Native OpenAI Responses semantics.
    • Reasoning is exposed via native events/items like response.reasoning_summary_text.delta, reasoning output items, and function_call items/events.
    • Preferred for the richest reasoning lifecycle.

    /v1/messages

    • Native Claude Messages request/response format.
    • Best for Claude-native clients or integrations expecting Anthropic-style payloads.
    # Check available models via the API
    curl http://localhost:8090/v1/models
  9. Launch supported tools

    main

    The launchdock launch <tool> command is used to start specific AI coding tools. Supported tools include:

    • claude-code
    • codex
    • opencode
    • droid
    • pi

    When using opencode, use the --config flag to merge settings into your existing configuration without overwriting unrelated keys.

    # Launch opencode and update its config
    launchdock launch opencode --config
  10. Manage the launchdock runtime

    main

    Use the following commands to manage the lifecycle of the local launchdock process:

    • launchdock start: Starts the local runtime.
    • launchdock stop: Stops the runtime.
    • launchdock restart: Restarts the runtime.
    • launchdock ps: Shows the current process status.
    • launchdock logs: Views the runtime logs.
    • launchdock update: Updates launchdock to the latest version.
  11. Load all available credential views with LoadCredentialViews

    main

    Use LoadCredentialViews to retrieve a consolidated list of all credentials available to the system. This function aggregates credentials from multiple sources, including:

    1. Keychain: Credentials loaded from the system keychain (associated with claude).
    2. Codex: Credentials loaded from the local file ~/.codex/auth.json.
    3. Managed Credentials: Credentials defined in the Launchdock configuration.

    The returned slice is sorted by management status (managed first), then by provider, and finally by label. It also performs email enrichment to ensure consistent identity mapping across different providers.

    import "github.com/nghyane/nghyane/launchdock"
    
    views := launchdock.LoadCredentialViews()
    for _, view := range views {
        fmt.Printf("Label: %s, Status: %s\n", view.Label, view.Status)
    }
  12. Configure Codex via launchdock

    main
    For codex, launchdock manages a config.toml file located at ~/.codex/config.toml. It injects a [model_providers.launchdock] block containing the base_url and the environment key LAUNCHDOCK_KEY. The function stripCodexProviderBlock is used to ensure that existing launchdock or llm-mux provider blocks are cleaned up before writing the new configuration to prevent duplication.