Skip to content
Open
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
17 changes: 17 additions & 0 deletions starter/hono-ai-sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,20 @@ To deploy:
npm install
vc deploy
```


### Usage

Pass a prompt via the `prompt` URL query parameter to get a streamed response:

- Browser:
- `http://localhost:3000/?prompt=What%20is%20the%20capital%20of%20France?`

- cURL:

```bash
curl -G 'http://localhost:3000/' \
--data-urlencode 'prompt=What is the capital of France?'
```

If `prompt` is omitted, the server falls back to a default prompt.
3 changes: 2 additions & 1 deletion starter/hono-ai-sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@ import { stream } from 'hono/streaming'

const app = new Hono()

const prompt = 'Why is the sky blue?'
const defaultPrompt = 'Why is the sky blue?'

app.get('/', async (c) => {
const prompt = c.req.query('prompt') ?? defaultPrompt
const result = streamText({
model: 'xai/grok-3',
prompt,
Expand Down