Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions specification/DigitalOcean-public.v2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2972,14 +2972,6 @@ components:
curl -X POST -H "Authorization: Bearer $MODEL_ACCESS_KEY" "https://inference.do-ai.run/v1/chat/completions"
```

```
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $MODEL_ACCESS_KEY" -d '{"model":"claude-opus-4-6","max_tokens":1024,"messages":[{"role":"user","content":"Hello"}]}' "https://inference.do-ai.run/v1/messages"
```

```
curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $MODEL_ACCESS_KEY" -d '{"model":"qwen3-embedding-0.6b","input":["hello world","goodbye world"],"encoding_format":"float","user":"user-1234"}' "https://inference.do-ai.run/v1/embeddings"
```

**Agent Inference:**

```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,7 @@ responses:
$ref: '../../shared/responses/unexpected_error.yml'
x-codeSamples:
- $ref: 'examples/curl/agentInference_create_chat_completion.yml'
- $ref: 'examples/python/agentInference_create_chat_completion.yml'
- $ref: 'examples/dots/agentInference_create_chat_completion.yml'
security:
- inference_bearer_auth: []
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
lang: cURL
source: |-
# Image Generation
curl -X POST \
-H "Authorization: Bearer $MODEL_ACCESS_KEY" \
-H "Content-Type: application/json" \
Expand All @@ -10,3 +11,34 @@ source: |-
}
}' \
"https://inference.do-ai.run/v1/async-invoke"

# Audio Generation
curl -X POST \
-H "Authorization: Bearer $MODEL_ACCESS_KEY" \
-H "Content-Type: application/json" \
-d '{
"model_id": "fal-ai/stable-audio-25/text-to-audio",
"input": {
"prompt": "Techno song with futuristic sounds",
"seconds_total": 60
},
"tags": [
{"key": "type", "value": "test"}
]
}' \
"https://inference.do-ai.run/v1/async-invoke"

# Text-to-Speech
curl -X POST \
-H "Authorization: Bearer $MODEL_ACCESS_KEY" \
-H "Content-Type: application/json" \
-d '{
"model_id": "fal-ai/elevenlabs/tts/multilingual-v2",
"input": {
"text": "This text-to-speech example uses DigitalOcean multilingual voice."
},
"tags": [
{"key": "type", "value": "test"}
]
}' \
"https://inference.do-ai.run/v1/async-invoke"

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
lang: JavaScript
source: |-
import { InferenceClient } from "@digitalocean/dots";

const client = new InferenceClient({
apiKey: process.env.AGENT_ACCESS_KEY,
baseURL: `https://${process.env.AGENT_URL}/api`,
});

const completion = await client.chat.completions.create({
model: "llama3.3-70b-instruct",
messages: [
{ role: "user", content: "What is the capital of Portugal?" },
],
});

console.log(completion.choices[0].message.content);
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
lang: JavaScript
source: |-
import { InferenceClient } from "@digitalocean/dots";

const client = new InferenceClient({
apiKey: process.env.MODEL_ACCESS_KEY,
});

// Image Generation
const imgResp = await client.async_images.generate({
model_id: "fal-ai/flux/schnell",
prompt: "A futuristic city at sunset",
});
console.log(imgResp.request_id, imgResp.status);

// Audio Generation
const audioResp = await client.audio.generate({
model_id: "fal-ai/stable-audio-25/text-to-audio",
prompt: "Techno song with futuristic sounds",
seconds_total: 60,
});
console.log(audioResp.request_id, audioResp.status);

// Text-to-Speech
const ttsResp = await client.audio.speech.create({
model_id: "fal-ai/elevenlabs/tts/multilingual-v2",
input: "This text-to-speech example uses DigitalOcean multilingual voice.",
});
console.log(ttsResp.request_id, ttsResp.status);
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
lang: JavaScript
source: |-
import { InferenceClient } from "@digitalocean/dots";

const client = new InferenceClient({
apiKey: process.env.MODEL_ACCESS_KEY,
});

const completion = await client.chat.completions.create({
model: "llama3.3-70b-instruct",
messages: [
{ role: "user", content: "What is the capital of Portugal?" },
],
});

console.log(completion.choices[0].message.content);
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
lang: JavaScript
source: |-
import { InferenceClient } from "@digitalocean/dots";

const client = new InferenceClient({
apiKey: process.env.MODEL_ACCESS_KEY,
});

const resp = await client.embeddings.create({
model: "qwen3-embedding-0.6b",
input: ["hello world", "goodbye world"],
encoding_format: "float",
user: "user-1234",
});

for (const item of resp.data) {
console.log(item.index, item.embedding.slice(0, 8));
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
lang: JavaScript
source: |-
import { InferenceClient } from "@digitalocean/dots";

const client = new InferenceClient({
apiKey: process.env.MODEL_ACCESS_KEY,
});

const resp = await client.images.generate({
model: "openai-gpt-image-1",
prompt: "A cute baby sea otter floating on its back in calm blue water",
size: "auto",
quality: "auto",
n: 1,
});

console.log(resp.data[0].b64_json);
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
lang: JavaScript
source: |-
import { InferenceClient } from "@digitalocean/dots";

const client = new InferenceClient({
apiKey: process.env.MODEL_ACCESS_KEY,
});

const resp = await client.messages.create({
model: "claude-opus-4-6",
max_tokens: 1024,
messages: [
{ role: "user", content: "What is the capital of Portugal?" },
],
});

console.log(resp.content[0].text);
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
lang: JavaScript
source: |-
import { InferenceClient } from "@digitalocean/dots";

const client = new InferenceClient({
apiKey: process.env.MODEL_ACCESS_KEY,
});

const resp = await client.responses.create({
model: "openai-gpt-oss-20b",
input: "What is the capital of France?",
max_output_tokens: 50,
temperature: 0.7,
});

console.log(resp.output_text);
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
lang: JavaScript
source: |-
import { InferenceClient } from "@digitalocean/dots";

const client = new InferenceClient({
apiKey: process.env.MODEL_ACCESS_KEY,
});

const resp = await client.models.list();

for (const model of resp.data) {
console.log(model.id);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
lang: Python
source: |-
import os
from pydo import Client

client = Client(
token=os.environ.get("AGENT_ACCESS_KEY"),
agent_endpoint=os.environ.get("AGENT_ENDPOINT"),
)

resp = client.agent.chat.completions.create(
model="llama3.3-70b-instruct",
messages=[
{"role": "user", "content": "What is the capital of Portugal?"},
],
)

print(resp.choices[0].message.content)
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
lang: Python
source: |-
import os
from pydo import Client

client = Client(token=os.environ.get("MODEL_ACCESS_KEY"))

# Image Generation
resp = client.async_images.generate(
model_id="fal-ai/flux/schnell",
prompt="A futuristic city at sunset",
)
print(resp.request_id, resp.status)

# Audio Generation
resp = client.audio.generate(
model_id="fal-ai/stable-audio-25/text-to-audio",
prompt="Techno song with futuristic sounds",
seconds_total=60,
)
print(resp.request_id, resp.status)

# Text-to-Speech
resp = client.audio.speech.create(
input="This text-to-speech example uses DigitalOcean multilingual voice.",
model_id="fal-ai/elevenlabs/tts/multilingual-v2",
)
print(resp.request_id, resp.status)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
lang: Python
source: |-
import os
from pydo import Client

client = Client(token=os.environ.get("MODEL_ACCESS_KEY"))

resp = client.chat.completions.create(
model="llama3.3-70b-instruct",
messages=[
{"role": "user", "content": "What is the capital of Portugal?"},
],
)

print(resp.choices[0].message.content)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
lang: Python
source: |-
import os
from pydo import Client

client = Client(token=os.environ.get("MODEL_ACCESS_KEY"))

resp = client.embeddings.create(
model="qwen3-embedding-0.6b",
input=["hello world", "goodbye world"],
encoding_format="float",
user="user-1234",
)

for item in resp.data:
print(item.index, item.embedding[:8])
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
lang: Python
source: |-
import os
from pydo import Client

client = Client(token=os.environ.get("MODEL_ACCESS_KEY"))

resp = client.images.generate(
model="openai-gpt-image-1",
prompt="A cute baby sea otter floating on its back in calm blue water",
size="auto",
quality="auto",
n=1,
)

print(resp.data[0].b64_json)
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
lang: Python
source: |-
import os
from pydo import Client

client = Client(token=os.environ.get("MODEL_ACCESS_KEY"))

resp = client.messages.create(
model="claude-opus-4-6",
max_tokens=1024,
messages=[
{"role": "user", "content": "What is the capital of Portugal?"},
],
)

print(resp.content[0].text)
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
lang: Python
source: |-
import os
from pydo import Client

client = Client(token=os.environ.get("MODEL_ACCESS_KEY"))

resp = client.responses.create(
model="openai-gpt-oss-20b",
input="What is the capital of France?",
max_output_tokens=50,
temperature=0.7,
)

print(resp.output[0].content[0].text)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
lang: Python
source: |-
import os
from pydo import Client

client = Client(token=os.environ.get("MODEL_ACCESS_KEY"))

resp = client.models.list()

for model in resp.data:
print(model.id)
Loading
Loading