Skip to content
Back to skills

Openrouter Hello World

ASecurity

Create your first OpenRouter API request with a simple example. Use when learning OpenRouter or testing your setup. Trigger with phrases like 'openrouter hello world', 'openrouter first request', 'openrouter quickstart', 'test openrouter'.

  • 4 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 10, 2026
ai-agentspythongonodetestingapidocumentation

Works with

  • api

Security analysis

A100/100

Pro scans all 7 files and shows the line behind each finding

Scanned September 10, 2026

npx -y skills add micsapp/micstec-skills --skill openrouter-hello-world --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Openrouter Hello World?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Openrouter Hello World
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/micsapp-openrouter-hello-world/badge)](https://www.skillsdirectory.com/skills/micsapp-openrouter-hello-world)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: openrouter-hello-world
description: |
  Create your first OpenRouter API request with a simple example. Use when learning OpenRouter or testing your setup. Trigger with phrases like 'openrouter hello world', 'openrouter first request', 'openrouter quickstart', 'test openrouter'.
allowed-tools: Read, Write, Edit, Grep
version: 1.0.0
license: MIT
author: Jeremy Longshore <jeremy@intentsolutions.io>
compatible-with: claude-code, codex, openclaw
---
# Openrouter Hello World

## Overview

This skill provides a minimal working example to verify your OpenRouter integration is functioning and introduces the basic request/response pattern.

## Prerequisites

- OpenRouter API key configured
- Python 3.8+ or Node.js 18+
- OpenAI SDK installed

## Instructions

1. **Set your API key**: Export `OPENROUTER_API_KEY` as an environment variable or add it to your `.env` file
2. **Send a test completion**: Make a POST request to `https://openrouter.ai/api/v1/chat/completions` with a simple prompt using `model: "openai/gpt-3.5-turbo"`
3. **Verify the response**: Confirm the response contains `choices[0].message.content` and `usage` token counts
4. **Try a different model**: Swap the model to `anthropic/claude-3-haiku` or `google/gemma-2-9b-it:free` to confirm multi-model routing works

## Output

- A JSON response with `id`, `model`, `choices`, and `usage` fields
- Token usage breakdown (prompt_tokens, completion_tokens, total_tokens)
- Confirmation that your API key and network configuration are correct

## Error Handling

| Error | Cause | Fix |
|-------|-------|-----|
| 401 Unauthorized | Invalid or missing API key | Verify key starts with `sk-or-` and is exported correctly |
| 404 Not Found | Wrong base URL | Use `https://openrouter.ai/api/v1` (not v2) |
| 400 Bad Request | Malformed JSON body | Check `messages` array has `role` and `content` fields |

See `${CLAUDE_SKILL_DIR}/references/errors.md` for full error reference.

## Examples

See `${CLAUDE_SKILL_DIR}/references/examples.md` for runnable code samples.

## Resources

- [OpenRouter Documentation](https://openrouter.ai/docs)
- [OpenRouter Models](https://openrouter.ai/models)
- [OpenRouter API Reference](https://openrouter.ai/docs/api-reference)
- [OpenRouter Status](https://status.openrouter.ai)

Files in this skill

  • SKILL.md2.2 KB
  • references/errors.md323 B
  • references/examples.md2.5 KB
  • references/python-example.md702 B
  • references/try-different-models.md1 KB
  • references/typescript-example.md787 B
  • references/your-first-request.md704 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.