Skip to content

Create Deployments ​

Learn how to create a new deployment using either the Nosana HTTP API or the TypeScript SDK.

Prerequisites ​

Before creating deployments, ensure you have:

  • API Key: A valid Nosana API key. See the API key guide.
  • Credit Balance: Sufficient credit balance on your Nosana account to run deployments.
  • Job Definition: A valid job definition describing the container workload. You can validate it locally with the SDK before creating the deployment.

What you configure ​

When creating a deployment, you specify:

  • A unique name for your deployment
  • The target market (GPU market address)
  • Deployment configuration: timeout, replicas, strategy
  • The job definition (container image, commands, operations)

For all available fields, see Deployment Options. You can find GPU markets here.

Create a Deployment ​

ts
import { 
function createNosanaClient(network: NosanaNetwork | undefined, customConfig: PartialClientConfig & {
    connect: ConnectFactoryConfig & {
        clientSecret: string;
    };
}): NosanaClient & {
    connect: ServerConnect;
} (+3 overloads)
createNosanaClient
,
type NosanaNetwork = "mainnet" | "devnet" | "localnet"
const NosanaNetwork: {
    readonly MAINNET: "mainnet";
    readonly DEVNET: "devnet";
    readonly LOCALNET: "localnet";
}
NosanaNetwork
} from '@nosana/kit';
const const client: NosanaClientclient = function createNosanaClient(network?: NosanaNetwork, customConfig?: PartialClientConfig): NosanaClient (+3 overloads)createNosanaClient(
const NosanaNetwork: {
    readonly MAINNET: "mainnet";
    readonly DEVNET: "devnet";
    readonly LOCALNET: "localnet";
}
NosanaNetwork
.type MAINNET: "mainnet"MAINNET, {
PartialClientConfig.api?: Partial<APIConfig> | undefinedapi: { apiKey?: string | undefinedapiKey:
const process: {
    env: Record<string, string>;
}
process
.env: Record<string, string>env.stringNOSANA_API_KEY,
}, }); async function function createDeployment(): Promise<void>createDeployment() { const const deployment: ApiDeploymentdeployment = await const client: NosanaClientclient.NosanaClient.api: NosanaApiClientapi.deployments: DeploymentsApi | ApiDeploymentsApideployments.create: (deploymentBody: CreateDeployment) => Promise<ApiDeployment>create({ name: stringname: 'Hello World', market?: string | undefined
@descriptionMarket to post every job in. Omit to post across markets: each job goes to the cheapest PREMIUM market with a node that meets `requirements`.
market
: '7AtiXMSH6R1jjBxrcYjehCkkSF7zvYWte63gwEDBcGHq',
timeout: number
@descriptionTimeout in minutes, must be at least 1 minute.@descriptionTimeout in minutes, must be at least 60 minute.
timeout
: 60, // minutes
replicas: numberreplicas: 1, strategy: "SIMPLE" | "SIMPLE-EXTEND" | "SCHEDULED" | "INFINITE"
@enum@enum
strategy
: 'SIMPLE',
job_definition: JobDefinitionjob_definition: { version: stringversion: '0.1', type?: string | undefined
@deprecatedThe execution environment is no longer derived from the job definition — it is the node operator's `--vm`/`--cvm` choice. Retained as an optional, unvalidated field so type-less jobs and legacy jobs still carrying `'container' | 'vm' | 'cvm'` continue to validate. Do not read it.
type
: 'container',
meta?: Meta | undefinedmeta: { trigger?: string | undefinedtrigger: 'api', }, ops: Opsops: [ { type: keyof OperationArgsMaptype: 'container/run', id: OperationIdid: 'hello-world', args: ContainerRun | ContainerCreateVolume | VmRunArgsargs: { cmd: stringcmd: 'for i in `seq 1 30`; do echo $i; sleep 1; done', image: stringimage: 'ubuntu', }, }, ], }, }); }

The response contains the created deployment, including its id, which you will need to start or manage it.

Start a Deployment ​

New deployments are created in a draft state and must be explicitly started:

ts
async function function startDeployment(id: string): Promise<void>startDeployment(id: stringid: string) {
  const const deployment: ApiDeploymentdeployment = await const client: NosanaClientclient.NosanaClient.api: NosanaApiClientapi.deployments: DeploymentsApi | ApiDeploymentsApideployments.get: (deployment: string) => Promise<ApiDeployment>get(id: stringid);
  await const deployment: ApiDeploymentdeployment.start: () => Promise<void>start();
}

Replace <deployment_id> with the id returned from the create call.