DigitalOcean.Inference reference
CancelBatch
Section titled “CancelBatch”Source:
packages/digitalocean/src/Inference/CancelBatch.ts
Cancels a running batch. Serverless Inference, from a runtime, with a model access key the host receives as a secret.
CancelBatch: Examples
Section titled “CancelBatch: Examples”export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url }, Effect.gen(function* () { const key = yield* Config.Redacted("DO_MODEL_KEY"); const cancel = yield* DigitalOcean.Inference.CancelBatch({ key }); return { fetch: Effect.gen(function* () { yield* cancel({ batch_id }); return yield* HttpServerResponse.json(out); }).pipe(Effect.orDie), }; }).pipe(Effect.provide(DigitalOcean.Inference.CancelBatchHttp)),) {}CancelBatchHttp
Section titled “CancelBatchHttp”Source:
packages/digitalocean/src/Inference/CancelBatchHttp.tsKind: Layer · Provides:DigitalOcean.Inference.CancelBatch
CancelBatch over Serverless Inference (https://inference.do-ai.run).
CreateAsyncInvoke
Section titled “CreateAsyncInvoke”Source:
packages/digitalocean/src/Inference/CreateAsyncInvoke.ts
Starts an asynchronous model invocation (/v1/async-invoke). Serverless Inference, from a runtime, with a model access key
the host receives as a secret.
CreateAsyncInvoke: Examples
Section titled “CreateAsyncInvoke: Examples”export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url }, Effect.gen(function* () { const key = yield* Config.Redacted("DO_MODEL_KEY"); const invoke = yield* DigitalOcean.Inference.CreateAsyncInvoke({ key }); return { fetch: Effect.gen(function* () { const job = yield* invoke({ model_id: "fal-ai/flux/schnell", input: { prompt: "a lighthouse" } }); return yield* HttpServerResponse.json(out); }).pipe(Effect.orDie), }; }).pipe(Effect.provide(DigitalOcean.Inference.CreateAsyncInvokeHttp)),) {}CreateAsyncInvokeHttp
Section titled “CreateAsyncInvokeHttp”Source:
packages/digitalocean/src/Inference/CreateAsyncInvokeHttp.tsKind: Layer · Provides:DigitalOcean.Inference.CreateAsyncInvoke
CreateAsyncInvoke over Serverless Inference (https://inference.do-ai.run).
CreateBatch
Section titled “CreateBatch”Source:
packages/digitalocean/src/Inference/CreateBatch.ts
Starts a batch of requests from an uploaded file. Serverless Inference, from a runtime, with a model access key the host receives as a secret.
CreateBatch: Examples
Section titled “CreateBatch: Examples”export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url }, Effect.gen(function* () { const key = yield* Config.Redacted("DO_MODEL_KEY"); const createBatch = yield* DigitalOcean.Inference.CreateBatch({ key }); return { fetch: Effect.gen(function* () { const batch = yield* createBatch({ input_file_id, endpoint: "/v1/chat/completions", completion_window: "24h" }); return yield* HttpServerResponse.json(out); }).pipe(Effect.orDie), }; }).pipe(Effect.provide(DigitalOcean.Inference.CreateBatchHttp)),) {}CreateBatchFile
Section titled “CreateBatchFile”Source:
packages/digitalocean/src/Inference/CreateBatchFile.ts
Registers a batch input file and returns its upload URL. Serverless Inference, from a runtime, with a model access key the host receives as a secret.
CreateBatchFile: Examples
Section titled “CreateBatchFile: Examples”export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url }, Effect.gen(function* () { const key = yield* Config.Redacted("DO_MODEL_KEY"); const createFile = yield* DigitalOcean.Inference.CreateBatchFile({ key }); return { fetch: Effect.gen(function* () { const file = yield* createFile({ file_name: "requests.jsonl" }); return yield* HttpServerResponse.json(out); }).pipe(Effect.orDie), }; }).pipe(Effect.provide(DigitalOcean.Inference.CreateBatchFileHttp)),) {}CreateBatchFileHttp
Section titled “CreateBatchFileHttp”Source:
packages/digitalocean/src/Inference/CreateBatchFileHttp.tsKind: Layer · Provides:DigitalOcean.Inference.CreateBatchFile
CreateBatchFile over Serverless Inference (https://inference.do-ai.run).
CreateBatchHttp
Section titled “CreateBatchHttp”Source:
packages/digitalocean/src/Inference/CreateBatchHttp.tsKind: Layer · Provides:DigitalOcean.Inference.CreateBatch
CreateBatch over Serverless Inference (https://inference.do-ai.run).
CreateChatCompletion
Section titled “CreateChatCompletion”Source:
packages/digitalocean/src/Inference/CreateChatCompletion.ts
Generates a chat completion (OpenAI /v1/chat/completions). Serverless Inference, from a runtime, with a model access key
the host receives as a secret.
CreateChatCompletion: Examples
Section titled “CreateChatCompletion: Examples”export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url }, Effect.gen(function* () { const key = yield* Config.Redacted("DO_MODEL_KEY"); const chat = yield* DigitalOcean.Inference.CreateChatCompletion({ key }); return { fetch: Effect.gen(function* () { const out = yield* chat({ model: "mistral-3-14B", messages: [{ role: "user", content: "Say hello" }], }); return yield* HttpServerResponse.json(out); }).pipe(Effect.orDie), }; }).pipe(Effect.provide(DigitalOcean.Inference.CreateChatCompletionHttp)),) {}CreateChatCompletionHttp
Section titled “CreateChatCompletionHttp”Source:
packages/digitalocean/src/Inference/CreateChatCompletionHttp.tsKind: Layer · Provides:DigitalOcean.Inference.CreateChatCompletion
CreateChatCompletion over Serverless Inference (https://inference.do-ai.run).
CreateEmbedding
Section titled “CreateEmbedding”Source:
packages/digitalocean/src/Inference/CreateEmbedding.ts
Embeds text as vectors (/v1/embeddings). Serverless Inference, from a runtime, with a model access key
the host receives as a secret.
CreateEmbedding: Examples
Section titled “CreateEmbedding: Examples”export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url }, Effect.gen(function* () { const key = yield* Config.Redacted("DO_MODEL_KEY"); const embed = yield* DigitalOcean.Inference.CreateEmbedding({ key }); return { fetch: Effect.gen(function* () { const out = yield* embed({ model: "qwen3-embedding-0.6b", input: "hello" }); return yield* HttpServerResponse.json(out); }).pipe(Effect.orDie), }; }).pipe(Effect.provide(DigitalOcean.Inference.CreateEmbeddingHttp)),) {}CreateEmbeddingHttp
Section titled “CreateEmbeddingHttp”Source:
packages/digitalocean/src/Inference/CreateEmbeddingHttp.tsKind: Layer · Provides:DigitalOcean.Inference.CreateEmbedding
CreateEmbedding over Serverless Inference (https://inference.do-ai.run).
CreateImage
Section titled “CreateImage”Source:
packages/digitalocean/src/Inference/CreateImage.ts
Generates images from a prompt (/v1/images/generations). Serverless Inference, from a runtime, with a model access key
the host receives as a secret.
CreateImage: Examples
Section titled “CreateImage: Examples”export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url }, Effect.gen(function* () { const key = yield* Config.Redacted("DO_MODEL_KEY"); const draw = yield* DigitalOcean.Inference.CreateImage({ key }); return { fetch: Effect.gen(function* () { const out = yield* draw({ model: "stable-diffusion-3.5-large", prompt: "a lighthouse" }); return yield* HttpServerResponse.json(out); }).pipe(Effect.orDie), }; }).pipe(Effect.provide(DigitalOcean.Inference.CreateImageHttp)),) {}CreateImageHttp
Section titled “CreateImageHttp”Source:
packages/digitalocean/src/Inference/CreateImageHttp.tsKind: Layer · Provides:DigitalOcean.Inference.CreateImage
CreateImage over Serverless Inference (https://inference.do-ai.run).
CreateMessage
Section titled “CreateMessage”Source:
packages/digitalocean/src/Inference/CreateMessage.ts
Generates a message (Anthropic Messages API, /v1/messages). Serverless Inference, from a runtime, with a model access key
the host receives as a secret.
CreateMessage: Examples
Section titled “CreateMessage: Examples”export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url }, Effect.gen(function* () { const key = yield* Config.Redacted("DO_MODEL_KEY"); const message = yield* DigitalOcean.Inference.CreateMessage({ key }); return { fetch: Effect.gen(function* () { const out = yield* message({ model: "mistral-3-14B", max_tokens: 256, messages: [{ role: "user", content: "Say hello" }], }); return yield* HttpServerResponse.json(out); }).pipe(Effect.orDie), }; }).pipe(Effect.provide(DigitalOcean.Inference.CreateMessageHttp)),) {}CreateMessageHttp
Section titled “CreateMessageHttp”Source:
packages/digitalocean/src/Inference/CreateMessageHttp.tsKind: Layer · Provides:DigitalOcean.Inference.CreateMessage
CreateMessage over Serverless Inference (https://inference.do-ai.run).
CreateResponse
Section titled “CreateResponse”Source:
packages/digitalocean/src/Inference/CreateResponse.ts
Generates a response (OpenAI Responses API, /v1/responses). Serverless Inference, from a runtime, with a model access key
the host receives as a secret.
CreateResponse: Examples
Section titled “CreateResponse: Examples”export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url }, Effect.gen(function* () { const key = yield* Config.Redacted("DO_MODEL_KEY"); const respond = yield* DigitalOcean.Inference.CreateResponse({ key }); return { fetch: Effect.gen(function* () { const out = yield* respond({ model: "mistral-3-14B", input: "Say hello" }); return yield* HttpServerResponse.json(out); }).pipe(Effect.orDie), }; }).pipe(Effect.provide(DigitalOcean.Inference.CreateResponseHttp)),) {}CreateResponseHttp
Section titled “CreateResponseHttp”Source:
packages/digitalocean/src/Inference/CreateResponseHttp.tsKind: Layer · Provides:DigitalOcean.Inference.CreateResponse
CreateResponse over Serverless Inference (https://inference.do-ai.run).
CreateSpeech
Section titled “CreateSpeech”Source:
packages/digitalocean/src/Inference/CreateSpeech.ts
Generates speech audio from text (/v1/audio/speech). Serverless Inference, from a runtime, with a model access key
the host receives as a secret.
CreateSpeech: Examples
Section titled “CreateSpeech: Examples”export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url }, Effect.gen(function* () { const key = yield* Config.Redacted("DO_MODEL_KEY"); const speak = yield* DigitalOcean.Inference.CreateSpeech({ key }); return { fetch: Effect.gen(function* () { const out = yield* speak({ model: "qwen3-tts-voicedesign", input: "hello" }); return yield* HttpServerResponse.json(out); }).pipe(Effect.orDie), }; }).pipe(Effect.provide(DigitalOcean.Inference.CreateSpeechHttp)),) {}CreateSpeechHttp
Section titled “CreateSpeechHttp”Source:
packages/digitalocean/src/Inference/CreateSpeechHttp.tsKind: Layer · Provides:DigitalOcean.Inference.CreateSpeech
CreateSpeech over Serverless Inference (https://inference.do-ai.run).
CreateSystemone
Section titled “CreateSystemone”Source:
packages/digitalocean/src/Inference/CreateSystemone.ts
Calls the SystemOne endpoint (/v1/systemone). Serverless Inference, from a runtime, with a model access key
the host receives as a secret.
CreateSystemone: Examples
Section titled “CreateSystemone: Examples”export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url }, Effect.gen(function* () { const key = yield* Config.Redacted("DO_MODEL_KEY"); const systemone = yield* DigitalOcean.Inference.CreateSystemone({ key }); return { fetch: Effect.gen(function* () { const out = yield* systemone({}); return yield* HttpServerResponse.json(out); }).pipe(Effect.orDie), }; }).pipe(Effect.provide(DigitalOcean.Inference.CreateSystemoneHttp)),) {}CreateSystemoneHttp
Section titled “CreateSystemoneHttp”Source:
packages/digitalocean/src/Inference/CreateSystemoneHttp.tsKind: Layer · Provides:DigitalOcean.Inference.CreateSystemone
CreateSystemone over Serverless Inference (https://inference.do-ai.run).
CreateVideo
Section titled “CreateVideo”Source:
packages/digitalocean/src/Inference/CreateVideo.ts
Starts a video generation (/v1/videos). Serverless Inference, from a runtime, with a model access key
the host receives as a secret.
CreateVideo: Examples
Section titled “CreateVideo: Examples”export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url }, Effect.gen(function* () { const key = yield* Config.Redacted("DO_MODEL_KEY"); const createVideo = yield* DigitalOcean.Inference.CreateVideo({ key }); return { fetch: Effect.gen(function* () { const job = yield* createVideo({ model, prompt: "waves at dusk" }); return yield* HttpServerResponse.json(out); }).pipe(Effect.orDie), }; }).pipe(Effect.provide(DigitalOcean.Inference.CreateVideoHttp)),) {}CreateVideoHttp
Section titled “CreateVideoHttp”Source:
packages/digitalocean/src/Inference/CreateVideoHttp.tsKind: Layer · Provides:DigitalOcean.Inference.CreateVideo
CreateVideo over Serverless Inference (https://inference.do-ai.run).
DedicatedInference
Section titled “DedicatedInference”Source:
packages/digitalocean/src/Inference/DedicatedInference.ts
A Dedicated Inference deployment: open-weight models served on GPUs reserved for you, behind an OpenAI-compatible endpoint in your VPC (and optionally a public one). Billed per GPU-hour while it exists. Models, GPUs and the public endpoint update in place.
DedicatedInference: Serving a Model
Section titled “DedicatedInference: Serving a Model”const vpc = yield* DigitalOcean.Vpc("ai", { region: "atl1", ipRange: "10.40.0.0/20" });const mistral = yield* DigitalOcean.Inference.DedicatedInference("mistral", { region: "atl1", vpcId: vpc.vpcId, publicEndpoint: true, models: [ { model: "mistralai/Mistral-7B-Instruct-v0.3", accelerators: [{ gpu: "gpu-mi300x1-192gb" }], }, ],});GetBatch
Section titled “GetBatch”Source:
packages/digitalocean/src/Inference/GetBatch.ts
Reads a batch’s status. Serverless Inference, from a runtime, with a model access key the host receives as a secret.
GetBatch: Examples
Section titled “GetBatch: Examples”export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url }, Effect.gen(function* () { const key = yield* Config.Redacted("DO_MODEL_KEY"); const getBatch = yield* DigitalOcean.Inference.GetBatch({ key }); return { fetch: Effect.gen(function* () { const batch = yield* getBatch({ batch_id }); return yield* HttpServerResponse.json(out); }).pipe(Effect.orDie), }; }).pipe(Effect.provide(DigitalOcean.Inference.GetBatchHttp)),) {}GetBatchHttp
Section titled “GetBatchHttp”Source:
packages/digitalocean/src/Inference/GetBatchHttp.tsKind: Layer · Provides:DigitalOcean.Inference.GetBatch
GetBatch over Serverless Inference (https://inference.do-ai.run).
GetBatchResults
Section titled “GetBatchResults”Source:
packages/digitalocean/src/Inference/GetBatchResults.ts
Reads where a finished batch’s results are. Serverless Inference, from a runtime, with a model access key the host receives as a secret.
GetBatchResults: Examples
Section titled “GetBatchResults: Examples”export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url }, Effect.gen(function* () { const key = yield* Config.Redacted("DO_MODEL_KEY"); const results = yield* DigitalOcean.Inference.GetBatchResults({ key }); return { fetch: Effect.gen(function* () { const out = yield* results({ batch_id }); return yield* HttpServerResponse.json(out); }).pipe(Effect.orDie), }; }).pipe(Effect.provide(DigitalOcean.Inference.GetBatchResultsHttp)),) {}GetBatchResultsHttp
Section titled “GetBatchResultsHttp”Source:
packages/digitalocean/src/Inference/GetBatchResultsHttp.tsKind: Layer · Provides:DigitalOcean.Inference.GetBatchResults
GetBatchResults over Serverless Inference (https://inference.do-ai.run).
GetVideo
Section titled “GetVideo”Source:
packages/digitalocean/src/Inference/GetVideo.ts
Reads a video generation’s status. Serverless Inference, from a runtime, with a model access key the host receives as a secret.
GetVideo: Examples
Section titled “GetVideo: Examples”export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url }, Effect.gen(function* () { const key = yield* Config.Redacted("DO_MODEL_KEY"); const getVideo = yield* DigitalOcean.Inference.GetVideo({ key }); return { fetch: Effect.gen(function* () { const job = yield* getVideo({ video_id }); return yield* HttpServerResponse.json(out); }).pipe(Effect.orDie), }; }).pipe(Effect.provide(DigitalOcean.Inference.GetVideoHttp)),) {}GetVideoContent
Section titled “GetVideoContent”Source:
packages/digitalocean/src/Inference/GetVideoContent.ts
Downloads a finished video. Serverless Inference, from a runtime, with a model access key the host receives as a secret.
GetVideoContent: Examples
Section titled “GetVideoContent: Examples”export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url }, Effect.gen(function* () { const key = yield* Config.Redacted("DO_MODEL_KEY"); const download = yield* DigitalOcean.Inference.GetVideoContent({ key }); return { fetch: Effect.gen(function* () { const video = yield* download({ video_id }); return yield* HttpServerResponse.json(out); }).pipe(Effect.orDie), }; }).pipe(Effect.provide(DigitalOcean.Inference.GetVideoContentHttp)),) {}GetVideoContentHttp
Section titled “GetVideoContentHttp”Source:
packages/digitalocean/src/Inference/GetVideoContentHttp.tsKind: Layer · Provides:DigitalOcean.Inference.GetVideoContent
GetVideoContent over Serverless Inference (https://inference.do-ai.run).
GetVideoHttp
Section titled “GetVideoHttp”Source:
packages/digitalocean/src/Inference/GetVideoHttp.tsKind: Layer · Provides:DigitalOcean.Inference.GetVideo
GetVideo over Serverless Inference (https://inference.do-ai.run).
ListBatches
Section titled “ListBatches”Source:
packages/digitalocean/src/Inference/ListBatches.ts
Lists batches. Serverless Inference, from a runtime, with a model access key the host receives as a secret.
ListBatches: Examples
Section titled “ListBatches: Examples”export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url }, Effect.gen(function* () { const key = yield* Config.Redacted("DO_MODEL_KEY"); const listBatches = yield* DigitalOcean.Inference.ListBatches({ key }); return { fetch: Effect.gen(function* () { const page = yield* listBatches({}); return yield* HttpServerResponse.json(out); }).pipe(Effect.orDie), }; }).pipe(Effect.provide(DigitalOcean.Inference.ListBatchesHttp)),) {}ListBatchesHttp
Section titled “ListBatchesHttp”Source:
packages/digitalocean/src/Inference/ListBatchesHttp.tsKind: Layer · Provides:DigitalOcean.Inference.ListBatches
ListBatches over Serverless Inference (https://inference.do-ai.run).
ListModels
Section titled “ListModels”Source:
packages/digitalocean/src/Inference/ListModels.ts
Lists the models the key can call (/v1/models). Serverless Inference, from a runtime, with a model access key
the host receives as a secret.
ListModels: Examples
Section titled “ListModels: Examples”export default class Api extends DigitalOcean.App<Api>()( "Api", { main: import.meta.url }, Effect.gen(function* () { const key = yield* Config.Redacted("DO_MODEL_KEY"); const listModels = yield* DigitalOcean.Inference.ListModels({ key }); return { fetch: Effect.gen(function* () { const models = yield* listModels({}); return yield* HttpServerResponse.json(out); }).pipe(Effect.orDie), }; }).pipe(Effect.provide(DigitalOcean.Inference.ListModelsHttp)),) {}ListModelsHttp
Section titled “ListModelsHttp”Source:
packages/digitalocean/src/Inference/ListModelsHttp.tsKind: Layer · Provides:DigitalOcean.Inference.ListModels
ListModels over Serverless Inference (https://inference.do-ai.run).