Testing with Postman
Postman is a popular API client that makes it easy to test API endpoints. This guide walks you through how to use Postman to test both v1 and v2 endpoints of the Arvae API.
Setting Up Postman
- Download and install Postman - If you don't already have Postman, download it from postman.com.
- Create a new Collection - In Postman, click on "Collections" and then the "+" button to create a new collection named "Arvae AI API".
- Add your API key as a variable - Click on the three dots next to your collection name, select "Edit," then go to the "Variables" tab. Add a variable named "api_key" with your API key as the value.
Setting Up Headers
For both v1 and v2 endpoints, you'll need to set up the following headers in Postman:
Header | Value | Description |
---|---|---|
Content-Type | application/json | Specifies that the request body is in JSON format |
Authorization | Bearer <API-KEY> | Your API key prefixed with "Bearer " |
TIP: In Postman, you can use variables to avoid hardcoding your API key. Use Bearer {api_key}
as the Authorization header value.
Testing the V1 Endpoint
The v1 endpoint is used for accessing third-party models like OpenAI, Anthropic, Google, etc.
Request Setup
- Create a new request - In your collection, click "Add request" and name it "V1 Chat Completion".
- Set the request method and URL:
- Method: POST
- URL:
https://arvae.ai/api/v1/chat/completions
- Add headers - Under the "Headers" tab, add the Content-Type and Authorization headers as described above.
- Add request body - Under the "Body" tab, select "raw" and choose "JSON" from the dropdown. Then add the JSON request:
Request Body Example:
1{
2 "model": "openai/chatgpt-4o-latest",
3 "messages": [
4 {
5 "role": "user",
6 "content": "hello, how are you"
7 }
8 ],
9 "temperature": 0.7,
10 "max_tokens": 1000,
11 "top_p": 1.0,
12 "stream": false
13}
Response Example
1{
2 "id": "arvae-1745773067-1VSEv2b7Nzk8wAZfMJst",
3 "model": "openai/chatgpt-4o-latest",
4 "choices": [
5 {
6 "finish_reason": "stop",
7 "index": 0,
8 "message": {
9 "role": "assistant",
10 "content": "Hello! I'm here and ready to help. How are you?"
11 }
12 }
13 ],
14 "token_metrics": {
15 "input_tokens": 12,
16 "output_tokens": 14,
17 "total_tokens": 26
18 }
19}
Testing the V2 Endpoint
The v2 endpoint is used exclusively for Hanooman models.
Request Setup
- Create a new request - In your collection, click "Add request" and name it "V2 Chat Completion".
- Set the request method and URL:
- Method: POST
- URL:
https://arvae.ai/api/v2/chat/completions
- Add headers - Under the "Headers" tab, add the Content-Type and Authorization headers as described above.
- Add request body - Under the "Body" tab, select "raw" and choose "JSON" from the dropdown. Then add the JSON request:
Request Body Example:
1{
2 "model": "hanooman/hanooman-everest",
3 "messages": [
4 {
5 "role": "user",
6 "content": "hello, how are you?"
7 }
8 ],
9 "temperature": 0.7,
10 "max_tokens": 1000,
11 "top_p": 1.0,
12 "web_search": false,
13 "stream": false
14}
Response Example
1{
2 "model": "hanooman/hanooman-everest",
3 "id": "arvae-id_yNwd8EyBzJJO1W2nV",
4 "conversation_id": null,
5 "choices": [
6 {
7 "index": 0,
8 "finish_reason": "stop",
9 "message": {
10 "role": "assistant",
11 "content": "Hello! I'm functioning optimally today, thank you for asking. How can I assist you?"
12 }
13 }
14 ],
15 "token_metrics": {
16 "input_tokens": 125,
17 "output_tokens": 21,
18 "total_tokens": 146
19 }
20}
Tips for Effective Testing
Using Environment Variables
Use Postman environment variables to easily switch between development and production environments.
- Create variables for your API base URL
- Store different API keys for different environments
- Reference variables using
{variable_name}
syntax
Testing Streaming Responses
To test streaming responses:
- Set
"stream": true
in your request body - In Postman, check the "Response is a streamed result" option under the "Body" tab
- Run the request and you'll see chunks of the response as they arrive
Troubleshooting
Common Issues
401 Unauthorized
Check that your API key is valid and properly formatted in the Authorization header (should be Bearer YOUR_API_KEY
).
400 Bad Request
Ensure your request body is properly formatted JSON and contains all required fields.
404 Not Found
Verify that the model ID exists and that you're using the correct endpoint (v1 or v2) for the model you're trying to use.