diff --git a/README.md b/README.md
index 5b0841c..af793bc 100644
--- a/README.md
+++ b/README.md
@@ -119,4 +119,24 @@ For Anthropic models above version 3 (i.e. Sonnet 3.5, Haiku 3.5, and Opus 3), w
## Cost table
-Units denominated in USD. All prices can be located [here](pricing_table.md).
\ No newline at end of file
+Units denominated in USD. All prices can be located [here](pricing_table.md).
+
+
+📊 View Full Pricing Table
+
+| Model Name | Prompt Cost (USD) per 1M tokens | Completion Cost (USD) per 1M tokens | Max Prompt Tokens | Max Output Tokens |
+|:-----------------------|:----------------------------------|:--------------------------------------|:--------------------|--------------------:|
+| gpt-4 | $30 | $60 | 8192 | 4096 |
+| gpt-4o | $2.5 | $10 | 128,000 | 16384 |
+| gpt-4o-mini | $0.15 | $0.6 | 128,000 | 16384 |
+| o1-mini | $1.1 | $4.4 | 128,000 | 65536 |
+| o1-preview | $15 | $60 | 128,000 | 32768 |
+| gpt-3.5-turbo | $1.5 | $2 | 16,385 | 4096 |
+| gpt-3.5-turbo-0125 | $0.5 | $1.5 | 16,385 | 4096 |
+| text-embedding-3-large | $0.13 | $0 | 8,191 | nan |
+| text-embedding-3-small | $0.02 | $0 | 8,191 | nan |
+| text-embedding-ada-002 | $0.1 | $0 | 8,191 | nan |
+
+*For the complete pricing table with all models, see [pricing_table.md](pricing_table.md)*
+
+
\ No newline at end of file
diff --git a/update_prices.py b/update_prices.py
index 4a5b769..fd2b8a1 100644
--- a/update_prices.py
+++ b/update_prices.py
@@ -122,3 +122,71 @@ def format_cost(x):
f.write(table_md)
print("Pricing table updated in pricing_table.md")
+
+# Update the README.md with the pricing table
+def update_readme_pricing_table():
+ """Update the pricing table in README.md with the latest data"""
+ # Read the current README
+ with open("README.md", "r") as f:
+ readme_content = f.read()
+
+ # Create a summary table with key models for the README
+ # Filter for the most important models to keep the README table manageable
+ important_models = [
+ 'gpt-4', 'gpt-4o', 'gpt-4o-mini', 'gpt-3.5-turbo', 'gpt-3.5-turbo-0125',
+ 'o1-mini', 'o1-preview', 'text-embedding-3-large', 'text-embedding-3-small',
+ 'text-embedding-ada-002'
+ ]
+
+ # Filter the dataframe for important models
+ summary_df = df[df.index.isin(important_models)]
+
+ # Generate the summary table
+ summary_table_md = summary_df[
+ [
+ "Model Name",
+ "Prompt Cost (USD) per 1M tokens",
+ "Completion Cost (USD) per 1M tokens",
+ "Max Prompt Tokens",
+ "Max Output Tokens",
+ ]
+ ].to_markdown(index=False)
+
+ # Create the new pricing table section
+ new_pricing_section = f"""## Cost table
+Units denominated in USD. All prices can be located [here](pricing_table.md).
+
+
+📊 View Full Pricing Table
+
+{summary_table_md}
+
+*For the complete pricing table with all models, see [pricing_table.md](pricing_table.md)*
+
+ """
+
+ # Find and replace the existing pricing table section
+ import re
+ pattern = r'## Cost table\nUnits denominated in USD\. All prices can be located \[here\]\(pricing_table\.md\)\.\n\n\n📊 View Full Pricing Table
\n\n.*?\n\n\*For the complete pricing table with all models, see \[pricing_table\.md\]\(pricing_table\.md\)\*\n\n '
+
+ if re.search(pattern, readme_content, re.DOTALL):
+ # Replace existing section
+ updated_readme = re.sub(pattern, new_pricing_section, readme_content, flags=re.DOTALL)
+ else:
+ # If no existing section found, add it before the end of the file
+ # Find the last section and add before it
+ lines = readme_content.split('\n')
+ for i in range(len(lines) - 1, -1, -1):
+ if lines[i].startswith('## '):
+ lines.insert(i, new_pricing_section)
+ break
+ updated_readme = '\n'.join(lines)
+
+ # Write the updated README
+ with open("README.md", "w") as f:
+ f.write(updated_readme)
+
+ print("Pricing table updated in README.md")
+
+# Update the README
+update_readme_pricing_table()