Credits & Models
The Pine Script AI Editor uses a credit-based system for AI interactions. This page explains how credits work and how to choose the right model for your task.
Credit System
Section titled “Credit System”How Credits Work
Section titled “How Credits Work”- You send a message → Credits are consumed
- AI processes request → Credit cost based on complexity
- Response generated → Cost deducted from your balance
What Uses Credits
Section titled “What Uses Credits”| Action | Uses Credits |
|---|---|
| ✅ Chat messages | Yes |
| ✅ Code generation | Yes |
| ✅ Fix with AI | Yes |
| ❌ Editing code | No |
| ❌ Validation | No |
| ❌ Saving files | No |
Credit Factors
Section titled “Credit Factors”Credit cost depends on:
- Input length — Your message + attached context
- Output length — AI’s response size
- Model choice — More capable models cost more
Checking Your Balance
Section titled “Checking Your Balance”In the Editor
Section titled “In the Editor”Your remaining credits appear in the chat panel footer:
Credits: 1,234 remainingIn Account Settings
Section titled “In Account Settings”Navigate to Account Settings → AI Credits for:
- Current balance
- Usage history
- Purchase options
Purchasing Credits
Section titled “Purchasing Credits”Credit Packages
Section titled “Credit Packages”| Package | Credits | Price | Best For |
|---|---|---|---|
| 20 credits | 20 | $10 | Small projects, testing |
| 50 credits | 50 | $20 | Regular development |
| 100 credits | 100 | $40 | Heavy daily use |
How to Purchase
Section titled “How to Purchase”- Click Buy Credits in the editor (when balance is low)
- Or go to Account Settings → AI Credits
- Select a package
- Complete checkout
Available Models
Section titled “Available Models”GPT-5 Codex (Recommended)
Section titled “GPT-5 Codex (Recommended)”The default model, optimized for code generation.
Strengths:
- Best at generating Pine Script code
- Understands complex trading logic
- Produces accurate diffs
Best for:
- Strategy generation
- Bug fixing
- Refactoring
Credit cost: Medium
GPT-5 Mini
Section titled “GPT-5 Mini”Faster, more economical model.
Strengths:
- Quick responses
- Lower credit cost
- Good for simple tasks
Best for:
- Quick questions
- Simple explanations
- Code comments
Credit cost: Low
GPT-5 Reasoning
Section titled “GPT-5 Reasoning”Advanced model with explicit reasoning.
Strengths:
- Shows reasoning process
- Better at complex problems
- More thorough analysis
Best for:
- Complex debugging
- Strategy optimization
- Report analysis
Credit cost: High
Choosing a Model
Section titled “Choosing a Model”Decision Matrix
Section titled “Decision Matrix”| Task | Recommended Model |
|---|---|
| Generate a strategy | GPT-5 Codex |
| Fix simple error | GPT-5 Mini |
| Explain concept | GPT-5 Mini |
| Complex bug | GPT-5 Reasoning |
| Optimize from report | GPT-5 Reasoning |
| Quick syntax question | GPT-5 Mini |
Switching Models
Section titled “Switching Models”- Find the model dropdown below the chat input
- Select your preferred model
- All subsequent messages use the new model
Optimizing Credit Usage
Section titled “Optimizing Credit Usage”Reduce Input Size
Section titled “Reduce Input Size”- Be concise — Shorter prompts cost less
- Share selections — Only attach relevant code, not full scripts
- Remove old context — Clear stale attachments
Use Appropriate Models
Section titled “Use Appropriate Models”- Simple tasks → Mini (cheap)
- Standard tasks → Codex (balanced)
- Complex tasks → Reasoning (expensive but thorough)
Batch Requests
Section titled “Batch Requests”Instead of:
Message 1: "Add a stop loss"Message 2: "Add a take profit"Message 3: "Add a trailing stop"Try:
"Add risk management:1. Stop loss at 2% below entry2. Take profit at 4% above entry3. Trailing stop of 1.5%"When Credits Run Low
Section titled “When Credits Run Low”Warning Indicators
Section titled “Warning Indicators”- Yellow — Balance getting low
- Red — Very few credits remaining
- Error — Cannot process request
What Happens at Zero
Section titled “What Happens at Zero”When credits are exhausted:
- AI requests fail with an error message
- You can still edit and save code
- Validation continues to work
- A prompt appears to purchase more
Plan Benefits
Section titled “Plan Benefits”Basic Plan
Section titled “Basic Plan”- Monthly credit allocation included
- Access to all models
- Standard support
Pro Plan
Section titled “Pro Plan”- Higher monthly credit allocation
- Priority processing
- Extended support
Understanding Credit Costs
Section titled “Understanding Credit Costs”Rough Estimates
Section titled “Rough Estimates”| Request Type | Approximate Cost |
|---|---|
| Short question | 5-15 credits |
| Code generation | 20-50 credits |
| Full strategy generation | 50-150 credits |
| Report analysis | 100-300 credits |
| Complex optimization | 200-500 credits |
Actual costs vary based on input/output length and model.
Context Costs
Section titled “Context Costs”Attached context increases costs:
| Attachment | Cost Impact |
|---|---|
| Code selection (small) | +5-10 credits |
| Full script | +20-50 credits |
| Analysis report | +50-150 credits |
| Image | +20-40 credits |
Frequently Asked Questions
Section titled “Frequently Asked Questions”Do unused credits expire?
Section titled “Do unused credits expire?”Purchased credits: Never expire Plan credits: Refresh monthly (don’t accumulate)
Can I see my usage history?
Section titled “Can I see my usage history?”Yes, in Account Settings → AI Credits → Usage History
What if I run out mid-conversation?
Section titled “What if I run out mid-conversation?”The current request fails, but your conversation and code are preserved. Purchase credits and continue.
Are credits refundable?
Section titled “Are credits refundable?”Credit purchases are typically non-refundable. Check the terms of service for details.
Related Sections
Section titled “Related Sections”- AI Chat Panel — Using the AI effectively
- Context & Attachments — Managing context size
- Account Settings — Billing and credits