|
| 1 | +# Quick Start Guide |
| 2 | + |
| 3 | +This guide will help you run all TypeScript SDK examples quickly. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +1. **Docker** - For running the Inference Gateway |
| 8 | +2. **Node.js** - For running the examples |
| 9 | +3. **API Key** - For at least one AI provider |
| 10 | + |
| 11 | +## 1. Setup Environment |
| 12 | + |
| 13 | +1. Copy the environment template: |
| 14 | + |
| 15 | + ```bash |
| 16 | + cp .env.example .env |
| 17 | + ``` |
| 18 | + |
| 19 | +2. Add your API keys to `.env`: |
| 20 | + ```bash |
| 21 | + # Choose one or more providers |
| 22 | + GROQ_API_KEY=your_groq_key_here |
| 23 | + OPENAI_API_KEY=your_openai_key_here |
| 24 | + ANTHROPIC_API_KEY=your_anthropic_key_here |
| 25 | + ``` |
| 26 | + |
| 27 | +## 2. Start Inference Gateway |
| 28 | + |
| 29 | +Choose one of these options: |
| 30 | + |
| 31 | +### Option A: Basic Gateway (for List and Chat examples) |
| 32 | + |
| 33 | +```bash |
| 34 | +docker run --rm -p 8080:8080 --env-file .env ghcr.io/inference-gateway/inference-gateway:latest |
| 35 | +``` |
| 36 | + |
| 37 | +### Option B: Gateway with MCP (for all examples) |
| 38 | + |
| 39 | +```bash |
| 40 | +cd mcp |
| 41 | +npm run compose:up |
| 42 | +``` |
| 43 | + |
| 44 | +## 3. Test the Examples |
| 45 | + |
| 46 | +### Quick Test - List Models |
| 47 | + |
| 48 | +```bash |
| 49 | +cd list |
| 50 | +npm install |
| 51 | +npm start |
| 52 | +``` |
| 53 | + |
| 54 | +### Chat Example |
| 55 | + |
| 56 | +```bash |
| 57 | +cd chat |
| 58 | +export PROVIDER=groq |
| 59 | +export LLM=meta-llama/llama-3.3-70b-versatile |
| 60 | +npm install |
| 61 | +npm start |
| 62 | +``` |
| 63 | + |
| 64 | +### MCP Example (requires Docker Compose setup) |
| 65 | + |
| 66 | +```bash |
| 67 | +cd mcp |
| 68 | +export PROVIDER=groq |
| 69 | +export LLM=meta-llama/llama-3.3-70b-versatile |
| 70 | +npm install |
| 71 | +npm start |
| 72 | +``` |
| 73 | + |
| 74 | +## 4. Popular Provider/Model Combinations |
| 75 | + |
| 76 | +### Groq (Fast inference) |
| 77 | + |
| 78 | +```bash |
| 79 | +export PROVIDER=groq |
| 80 | +export LLM=meta-llama/llama-3.3-70b-versatile |
| 81 | +``` |
| 82 | + |
| 83 | +### OpenAI (High quality) |
| 84 | + |
| 85 | +```bash |
| 86 | +export PROVIDER=openai |
| 87 | +export LLM=gpt-4o |
| 88 | +``` |
| 89 | + |
| 90 | +### Anthropic (Strong reasoning) |
| 91 | + |
| 92 | +```bash |
| 93 | +export PROVIDER=anthropic |
| 94 | +export LLM=claude-3-5-sonnet-20241022 |
| 95 | +``` |
| 96 | + |
| 97 | +## Troubleshooting |
| 98 | + |
| 99 | +### Gateway not responding |
| 100 | + |
| 101 | +- Check if Docker container is running: `docker ps` |
| 102 | +- Test health: `curl http://localhost:8080/health` |
| 103 | +- Check logs: `docker logs <container_id>` |
| 104 | + |
| 105 | +### Authentication errors |
| 106 | + |
| 107 | +- Verify API key is correct in `.env` |
| 108 | +- Ensure the key has sufficient permissions |
| 109 | +- Try a different provider |
| 110 | + |
| 111 | +### Model not found |
| 112 | + |
| 113 | +- Use the list example to see available models |
| 114 | +- Check if the model name is correct |
| 115 | +- Try a different model from the same provider |
| 116 | + |
| 117 | +## Next Steps |
| 118 | + |
| 119 | +1. Explore each example in detail |
| 120 | +2. Modify the examples for your use case |
| 121 | +3. Build your own applications using the patterns shown |
| 122 | +4. Check the main [README](../README.md) for more advanced usage |
0 commit comments