Skip to content

Commit a7285ea

Browse files
authored
update readme with integration example (#90)
1 parent abb567e commit a7285ea

1 file changed

Lines changed: 74 additions & 0 deletions

File tree

README.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,80 @@ Forge is an open-source middleware service that simplifies AI model provider man
4444
- **Seamless Integration**: Compatible with OpenAI API standard for easy integration with existing tools
4545
- **Enhanced Security**: Keys are encrypted and never exposed to end applications
4646

47+
## Developer Quickstart
48+
49+
Make your first API request in minutes. Learn the basics of the Forge platform.
50+
51+
### cURL Example
52+
53+
```bash
54+
curl https://api.forge.tensorblock.co/v1/chat/completions \
55+
-H "Content-Type: application/json" \
56+
-H "Authorization: Bearer $FORGE_API_KEY" \
57+
-d '{
58+
"model": "OpenAI/gpt-4o",
59+
"messages": [
60+
{
61+
"role": "developer",
62+
"content": "You are a helpful assistant."
63+
},
64+
{
65+
"role": "user",
66+
"content": "Hello!"
67+
}
68+
]
69+
}'
70+
```
71+
72+
### Python Example
73+
74+
```python
75+
from openai import OpenAI
76+
77+
client = OpenAI(
78+
base_url="https://api.forge.tensorblock.co/v1",
79+
api_key=FORGE_API_KEY,
80+
)
81+
82+
# models = client.models.list()
83+
84+
completion = client.chat.completions.create(
85+
model="OpenAI/gpt-4o",
86+
messages=[
87+
{"role": "developer", "content": "You are a helpful assistant."},
88+
{"role": "user", "content": "Hello!"}
89+
]
90+
)
91+
92+
print(completion.choices[0].message)
93+
```
94+
95+
### JavaScript/Node.js Example
96+
97+
```javascript
98+
const { OpenAI } = require("openai");
99+
100+
const client = new OpenAI({
101+
baseURL: "https://api.forge.tensorblock.co/v1",
102+
apiKey: FORGE_API_KEY,
103+
});
104+
105+
// const models = await openai.models.list();
106+
107+
async function main() {
108+
const completion = await client.chat.completions.create({
109+
model: "OpenAI/gpt-4o",
110+
messages: [
111+
{ role: "developer", content: "You are a helpful assistant." },
112+
{ role: "user", content: "Hello!" }
113+
]
114+
});
115+
console.log(completion.choices[0].message);
116+
}
117+
118+
main();
119+
```
120+
47121
## Key Features
48122

49123
- **Unified API Key**: Store multiple provider API keys and access all with a single Forge API key

0 commit comments

Comments
 (0)