Skip to content
This repository was archived by the owner on Apr 22, 2026. It is now read-only.

Commit 9b9c940

Browse files
koki-developclaude
andcommitted
docs: add custom headers usage example to README
🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 5df4580 commit 9b9c940

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

README.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,34 @@ def greet(name):
169169
});
170170
```
171171

172+
### Custom Headers
173+
174+
```typescript
175+
// Global headers (applied to all requests)
176+
const piston = new Piston("https://emkc.org/api/v2/piston", {
177+
headers: {
178+
Authorization: "Bearer your-api-key",
179+
},
180+
});
181+
182+
// Per-request headers (override global headers)
183+
const result = await piston.execute(
184+
{
185+
language: "python",
186+
version: "3.x",
187+
files: [{ content: 'print("Hello!")' }],
188+
},
189+
{
190+
headers: { "X-Request-Id": "req-123" },
191+
}
192+
);
193+
194+
// Also works with runtimes()
195+
const runtimes = await piston.runtimes({
196+
headers: { "X-Request-Id": "req-456" },
197+
});
198+
```
199+
172200
## Related Projects
173201

174202
- [Piston](https://github.com/engineer-man/piston) - The code execution engine

0 commit comments

Comments
 (0)