Requirements
The Dedalus Go SDK requires Go 1.22 or higher.
Before installing the SDK, ensure you have Go installed on your system:
If you need to install or upgrade Go, visit the official Go downloads page.
Install the SDK
Install the package
Add the Dedalus SDK to your Go project using go get:go get github.com/dedalus-labs/dedalus-sdk-go
Pinning to a specific version is recommended for production applications to ensure consistent behavior.
Import the SDK
Import the SDK in your Go code:import (
"github.com/dedalus-labs/dedalus-sdk-go"
"github.com/dedalus-labs/dedalus-sdk-go/option"
"github.com/dedalus-labs/dedalus-sdk-go/shared"
)
The package is imported as githubcomdedaluslabsdedalussdkgo due to Go’s import naming conventions.
Set up authentication
Configure your API key using environment variables or client options: Environment Variable
Client Option
Set the DEDALUS_API_KEY environment variable:export DEDALUS_API_KEY="your-api-key-here"
The client will automatically read this value:client := githubcomdedaluslabsdedalussdkgo.NewClient()
Pass the API key directly when creating the client:client := githubcomdedaluslabsdedalussdkgo.NewClient(
option.WithAPIKey("your-api-key-here"),
)
Environment Configuration
The SDK supports multiple environment configurations:
client := githubcomdedaluslabsdedalussdkgo.NewClient(
option.WithAPIKey("your-api-key"),
option.WithEnvironmentProduction(), // This is the default
)
Available Environment Variables
The SDK reads configuration from the following environment variables:
| Variable | Description | Default |
|---|
DEDALUS_API_KEY | Your Dedalus API key | Required |
DEDALUS_X_API_KEY | Additional API key for certain operations | Optional |
DEDALUS_PROVIDER_KEY | Provider-specific API key for BYOK | Optional |
DEDALUS_BASE_URL | Custom API base URL | Production URL |
DEDALUS_AS_URL | Custom AS URL for specific operations | Optional |
DEDALUS_ORG_ID | Organization ID for multi-org setups | Optional |
DEDALUS_PROVIDER | Default provider to use | Optional |
DEDALUS_PROVIDER_MODEL | Default provider model | Optional |
Verify Installation
Create a simple test file to verify your installation:
package main
import (
"context"
"fmt"
"github.com/dedalus-labs/dedalus-sdk-go"
"github.com/dedalus-labs/dedalus-sdk-go/option"
)
func main() {
client := githubcomdedaluslabsdedalussdkgo.NewClient(
option.WithAPIKey("your-api-key"),
)
models, err := client.Models.List(context.TODO())
if err != nil {
panic(err.Error())
}
fmt.Println("Available models:", len(models.Data))
}
Run the test:
If you see output listing available models, your installation is successful!
Next Steps
Quickstart Guide
Learn how to make your first API call with a complete chat completion example