Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"overrides": [
{
"files": ["*.json"],
"parser": "jsonc-eslint-parser",
"plugins": ["jsonc"],
"extends": ["plugin:jsonc/recommended-with-json"],
"rules": {
"jsonc/indent": ["error", 2],
"jsonc/key-spacing": "error",
"jsonc/object-curly-spacing": ["error", "always"]
}
}
]
}
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Bug Report
description: Create a report to help us improve
title: "[Bug] "
labels: ["bug"]
title: '[Bug] '
labels: ['bug']
body:
- type: textarea
id: description
Expand All @@ -10,7 +10,7 @@ body:
description: A clear and concise description of what the bug is.
validations:
required: true

- type: textarea
id: reproduction
attributes:
Expand All @@ -23,7 +23,7 @@ body:
4. See error
validations:
required: true

- type: textarea
id: expected
attributes:
Expand Down
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/new-model-request.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: New Model Request
description: Request pricing support for a new model or provider
title: "[Request] <Provider Name> - <Model Name>"
labels: ["new-model"]
title: '[Request] <Provider Name> - <Model Name>'
labels: ['new-model']
body:
- type: input
id: provider
Expand All @@ -11,7 +11,7 @@ body:
placeholder: OpenAI
validations:
required: true

- type: input
id: model
attributes:
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/pricing-update.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Pricing Update
description: Report incorrect or outdated pricing
title: "[Pricing] <Provider Name> - <Model Name>"
labels: ["pricing-update"]
title: '[Pricing] <Provider Name> - <Model Name>'
labels: ['pricing-update']
body:
- type: input
id: model_info
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/dev-sync-to-s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: DEV | Upload & Sync

on:
push:
branches: ["dev"]
branches: ['dev']
paths:
- "**/*.json"
- '**/*.json'
workflow_dispatch: {}

permissions:
Expand All @@ -25,9 +25,9 @@ jobs:
echo "════════════════════════════════════════════════════════════"
echo " VALIDATING PRICING CONFIGS"
echo "════════════════════════════════════════════════════════════"

ERRORS=0

for file in pricing/*.json; do
if ! jq empty "$file" 2>/dev/null; then
echo "❌ Invalid JSON: $file"
Expand All @@ -36,13 +36,13 @@ jobs:
echo "✅ $file"
fi
done

if [ $ERRORS -gt 0 ]; then
echo ""
echo "❌ Validation failed with $ERRORS error(s)"
exit 1
fi

echo ""
echo "✅ All JSON files are valid!"

Expand Down Expand Up @@ -118,10 +118,10 @@ jobs:
-H "Content-Type: application/json" \
https://api.github.com/repos/portkey-ai/gateway-enterprise-node/actions/workflows/sync-and-deploy.yml/dispatches \
-d '{"ref":"dev","inputs":{"source_branch":"dev"}}')

HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
BODY=$(echo "$RESPONSE" | sed '$d')

if [ "$HTTP_CODE" -eq 204 ]; then
echo "✅ Successfully triggered gateway sync-and-deploy workflow (staging)"
else
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/sync-to-s3.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: PROD | Upload & Sync

on:
push:
branches: ["main"]
branches: ['main']
paths:
- "**/*.json"
- '**/*.json'
workflow_dispatch: {}

permissions:
Expand All @@ -25,9 +25,9 @@ jobs:
echo "════════════════════════════════════════════════════════════"
echo " VALIDATING PRICING CONFIGS"
echo "════════════════════════════════════════════════════════════"

ERRORS=0

for file in pricing/*.json; do
if ! jq empty "$file" 2>/dev/null; then
echo "❌ Invalid JSON: $file"
Expand All @@ -36,13 +36,13 @@ jobs:
echo "✅ $file"
fi
done

if [ $ERRORS -gt 0 ]; then
echo ""
echo "❌ Validation failed with $ERRORS error(s)"
exit 1
fi

echo ""
echo "✅ All JSON files are valid!"

Expand Down Expand Up @@ -118,10 +118,10 @@ jobs:
-H "Content-Type: application/json" \
https://api.github.com/repos/portkey-ai/gateway-enterprise-node/actions/workflows/sync-and-deploy.yml/dispatches \
-d '{"ref":"main","inputs":{"source_branch":"main"}}')

HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
BODY=$(echo "$RESPONSE" | sed '$d')

if [ "$HTTP_CODE" -eq 204 ]; then
echo "✅ Successfully triggered gateway sync-and-deploy workflow (production)"
else
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/validate-json.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
ERRORS=$((ERRORS + 1))
fi
done

if [ $ERRORS -gt 0 ]; then
exit 1
fi
Expand All @@ -39,7 +39,7 @@ jobs:
ERRORS=$((ERRORS + 1))
fi
done

if [ $ERRORS -gt 0 ]; then
exit 1
fi
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged

5 changes: 5 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
dist/
.prettierrc.js
tsconfig.json

8 changes: 8 additions & 0 deletions .prettierrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
trailingComma: 'all',
tabWidth: 2,
semi: true,
singleQuote: true,
printWidth: 120,
bracketSpacing: true,
};
20 changes: 10 additions & 10 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ We pledge to act and interact in ways that contribute to an open, welcoming, div

Examples of behavior that contributes to a positive environment for our community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
* Focusing on what is best not just for us as individuals, but for the overall community
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
- The use of sexualized language or imagery, and sexual attention or advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Enforcement Responsibilities

Expand Down
64 changes: 33 additions & 31 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Thank you for your interest in contributing to the Portkey Models repository! Th

## Types of Contributions

| Contribution | Directory | Description |
|--------------|-----------|-------------|
| Contribution | Directory | Description |
| ------------- | ---------- | -------------------------------------------- |
| Model Pricing | `pricing/` | Token costs, image pricing, additional units |
| Model Configs | `general/` | Parameters, capabilities, supported features |

Expand All @@ -34,11 +34,11 @@ Pricing files are located in `pricing/{provider}.json`.

> ⚠️ **Prices are in cents per token, not dollars.**

| Provider Pricing | JSON Value | Calculation |
|------------------|------------|-------------|
| $0.03 / 1K tokens | `0.003` | $0.03 ÷ 1000 = 0.00003 dollars = 0.003 cents |
| $2.50 / 1M tokens | `0.00025` | $2.50 ÷ 1,000,000 = 0.0000025 dollars = 0.00025 cents |
| $10 / 1M tokens | `0.001` | $10 ÷ 1,000,000 = 0.00001 dollars = 0.001 cents |
| Provider Pricing | JSON Value | Calculation |
| ----------------- | ---------- | ----------------------------------------------------- |
| $0.03 / 1K tokens | `0.003` | $0.03 ÷ 1000 = 0.00003 dollars = 0.003 cents |
| $2.50 / 1M tokens | `0.00025` | $2.50 ÷ 1,000,000 = 0.0000025 dollars = 0.00025 cents |
| $10 / 1M tokens | `0.001` | $10 ÷ 1,000,000 = 0.00001 dollars = 0.001 cents |

**Quick formula:** `price_in_cents = (dollars_per_million / 1,000,000) * 100`

Expand All @@ -62,16 +62,16 @@ Pricing files are located in `pricing/{provider}.json`.

### Available Fields

| Field | Description |
|-------|-------------|
| `request_token` | Input token cost |
| `response_token` | Output token cost |
| `cache_write_input_token` | Cache write cost |
| `cache_read_input_token` | Cache read cost |
| `request_audio_token` | Audio input cost |
| `response_audio_token` | Audio output cost |
| `additional_units` | Provider-specific (web_search, thinking_token, etc.) |
| `image` | Image generation pricing by quality/size |
| Field | Description |
| ------------------------- | ---------------------------------------------------- |
| `request_token` | Input token cost |
| `response_token` | Output token cost |
| `cache_write_input_token` | Cache write cost |
| `cache_read_input_token` | Cache read cost |
| `request_audio_token` | Audio input cost |
| `response_audio_token` | Audio output cost |
| `additional_units` | Provider-specific (web_search, thinking_token, etc.) |
| `image` | Image generation pricing by quality/size |

### Adding a New Provider

Expand Down Expand Up @@ -133,30 +133,31 @@ Configuration files are located in `general/{provider}.json`.

### Type Values

| Primary Type | Description |
|--------------|-------------|
| `chat` | Chat completion models |
| `text` | Text completion models |
| `embedding` | Embedding models |
| `image` | Image generation models |
| `audio` | Audio models |
| Primary Type | Description |
| ------------ | ----------------------- |
| `chat` | Chat completion models |
| `text` | Text completion models |
| `embedding` | Embedding models |
| `image` | Image generation models |
| `audio` | Audio models |

| Supported Features | Description |
|-------------------|-------------|
| `tools` | Function calling support |
| `image` | Vision/image input support |
| `cache_control` | Prompt caching support |
| Supported Features | Description |
| ------------------ | -------------------------- |
| `tools` | Function calling support |
| `image` | Vision/image input support |
| `cache_control` | Prompt caching support |

## Submitting Your Changes

### Before Submitting

1. **Validate JSON syntax**

```bash
# Validate all pricing files
for file in pricing/*.json; do jq empty "$file" && echo "✅ $file"; done
# Validate all general files

# Validate all general files
for file in general/*.json; do jq empty "$file" && echo "✅ $file"; done
```

Expand All @@ -167,6 +168,7 @@ Configuration files are located in `general/{provider}.json`.
### Pull Request Guidelines

1. **Title format:** `[provider] Brief description`

- Example: `[openai] Add GPT-5 pricing`
- Example: `[anthropic] Update Claude 4 cache pricing`

Expand Down
Loading