Qwen3 Embedding 0.6B
Current-generation embeddings from a list of texts in one request, on a model small enough to cost almost nothing to keep warm.
What runs
This is the whole app. The entry names the model and what serves it, and the build turns that into these files: there is nothing else to write.
"""Qwen3 Embedding 0.6B, generated from a declarative template."""
from __future__ import annotations
from pydantic import BaseModel, ConfigDict, Field
from runware_serverless import serve
MODEL = "Qwen/Qwen3-Embedding-0.6B"
REVISION = "97b0c614be4d77ee51c0cef4e5f07c00f9eb65b3"
CACHE = "/weights"
class Request(BaseModel):
# An input this model does not read is a line the caller believed was doing
# something, so it is refused rather than dropped. Without this, pydantic
# ignores it: a width sent to a model of fixed size, or a misspelled seed,
# both come back as a result that silently answered a different request.
model_config = ConfigDict(extra="forbid")
texts: list[str] = Field(description="The texts to embed, in order.")
class Embedded(BaseModel):
vectors: list[list[float]]
dimensions: int
@serve
class GeneratedEmbeddings:
def load(self) -> None:
if hasattr(self, "model"):
return
from sentence_transformers import SentenceTransformer
self.model = SentenceTransformer(
MODEL, revision=REVISION, cache_folder=CACHE, device="cuda"
)
def predict(self, request: Request) -> Embedded:
vectors = self.model.encode(request.texts, normalize_embeddings=True)
return Embedded(
vectors=[vector.tolist() for vector in vectors],
dimensions=int(vectors.shape[-1]),
)configVersion: 1
id: qwen3-embedding-06b
name: Qwen3 Embedding 0.6B
source:
type: code
entry: model.py
compute:
gpuType: l40s
build:
requirements:
- torch==2.14.1
- sentence-transformers==5.1.2
baseImage: python:3.12
volumes:
- /weightsDeploying
Deploy it as it is, or take the files above and deploy your own copy. Nothing you change reaches back to this page.
runware serverless deploy --from https://runware.ai/docs/serverless/examples/qwen3-embedding-06b.ziprunware serverless deploy model.py \
--id qwen3-embedding-06b \
--gpu-type l40s \
--base-image python:3.12 \
--requirement torch==2.14.1 \
--requirement sentence-transformers==5.1.2 \
--volume /weightsCalling it
One request that works, against the app you just deployed. The fields are the ones the entry declares above, and anything it does not declare is refused rather than ignored.
import { createClient } from '@runware/sdk'
const client = await createClient({ apiKey: process.env.RUNWARE_API_KEY })
const task = await client.invoke({
appId: 'qwen3-embedding-06b',
endpointPath: 'predict',
payload: {
request: {
texts: [
'a cat sat on the mat',
'a kitten rested on the rug'
]
}
}
})import asyncio
import os
from runware import Runware
async def main():
client = Runware(api_key=os.environ["RUNWARE_API_KEY"])
try:
task = await client.invoke(
"qwen3-embedding-06b",
"predict",
{
"request": {
"texts": [
"a cat sat on the mat",
"a kitten rested on the rug"
]
}
},
)
finally:
await client.close()
asyncio.run(main())curl https://api.serverless.runware.ai/v1/apps/qwen3-embedding-06b/invoke-async/predict \
-H "Authorization: Bearer $RUNWARE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"taskId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"payload": {
"request": {
"texts": [
"a cat sat on the mat",
"a kitten rested on the rug"
]
}
}
}'cat <<'EOF' | runware serverless apps invoke qwen3-embedding-06b predict -f -
{
"request": {
"texts": [
"a cat sat on the mat",
"a kitten rested on the rug"
]
}
}
EOF{
"taskId": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"payload": {
"request": {
"texts": [
"a cat sat on the mat",
"a kitten rested on the rug"
]
}
}
}What it costs
This entry is pinned to l40s, which is the card it was tested on rather than the only one it runs on: --gpu-typedeploys it somewhere else. You pay for that card by the second while a worker holds it, and for nothing else. Pricing covers what meters, and the rates are published per GPU-second.